2009-02-02 18:12:33 +00:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
|
|
|
require File.join(File.dirname(__FILE__), '_common.rb')
|
2009-08-20 22:48:09 +00:00
|
|
|
db = Connection.new(DEFAULT_HOST, DEFAULT_PORT).db(DEFAULT_DB)
|
2009-02-02 18:12:33 +00:00
|
|
|
|
2009-02-05 21:00:45 +00:00
|
|
|
if $DEBUG
|
2009-02-05 19:47:33 +00:00
|
|
|
3.times { |i| db.drop_collection("test#{i+1}") }
|
|
|
|
db.create_collection('test1')
|
|
|
|
db.collection('test2').insert({:name => 'a'})
|
|
|
|
c = db.collection('test3')
|
|
|
|
100.times { |i| c.insert(:i => i, :foo => 'bar') }
|
|
|
|
end
|
|
|
|
|
2009-02-02 18:12:33 +00:00
|
|
|
puts db.collection('test1').count
|
|
|
|
puts db.collection('test2').count
|
2009-08-18 15:53:35 +00:00
|
|
|
puts db.collection('test3').find('i' => 'a').count
|
|
|
|
puts db.collection('test3').find('i' => 3).count
|
|
|
|
puts db.collection('test3').find({'i' => {'$gte' => 67}}).count
|