Added call to db.count to example. Need to see why it's not working.

This commit is contained in:
Jim Menard 2008-12-01 19:36:20 -05:00
parent 5e3815bf69
commit 8459fcad5b
3 changed files with 6 additions and 2 deletions

View File

@ -13,4 +13,8 @@ coll.insert(doc)
doc = {'a' => 2} doc = {'a' => 2}
coll.insert(doc) coll.insert(doc)
doc = {'a' => 3}
coll.insert(doc)
puts coll.count()
coll.find().each { |doc| puts doc.inspect } coll.find().each { |doc| puts doc.inspect }

View File

@ -112,7 +112,7 @@ module XGen
doc = db_command(:count => collection, :query => selector) doc = db_command(:count => collection, :query => selector)
o = doc['ok'] o = doc['ok']
return doc['n'].to_i if o.to_i == 1 return doc['n'].to_i if o.to_i == 1
raise "Error with count command: #{doc.to_s}" unless o.kind_of?(Numeric) raise "Error with count command: #{doc.inspect}"
end end
def drop_index(collection, name) def drop_index(collection, name)