Added call to db.count to example. Need to see why it's not working.
This commit is contained in:
parent
5e3815bf69
commit
8459fcad5b
2
Rakefile
2
Rakefile
|
@ -4,5 +4,5 @@ task :default => [:test]
|
||||||
|
|
||||||
# NOTE: some of the tests assume Mongo is running
|
# NOTE: some of the tests assume Mongo is running
|
||||||
Rake::TestTask.new do |t|
|
Rake::TestTask.new do |t|
|
||||||
t.test_files = FileList['tests/test*.rb']
|
t.test_files = FileList['tests/test*.rb']
|
||||||
end
|
end
|
||||||
|
|
|
@ -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 }
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue