From 8459fcad5bffddf1788a70d9a1dd54779cc8d7f3 Mon Sep 17 00:00:00 2001 From: Jim Menard Date: Mon, 1 Dec 2008 19:36:20 -0500 Subject: [PATCH] Added call to db.count to example. Need to see why it's not working. --- Rakefile | 2 +- examples/demo.rb | 4 ++++ lib/mongo/db.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index 53fdf76..48e1df6 100644 --- a/Rakefile +++ b/Rakefile @@ -4,5 +4,5 @@ task :default => [:test] # NOTE: some of the tests assume Mongo is running Rake::TestTask.new do |t| - t.test_files = FileList['tests/test*.rb'] + t.test_files = FileList['tests/test*.rb'] end diff --git a/examples/demo.rb b/examples/demo.rb index c1e1de5..a777862 100644 --- a/examples/demo.rb +++ b/examples/demo.rb @@ -13,4 +13,8 @@ coll.insert(doc) doc = {'a' => 2} coll.insert(doc) +doc = {'a' => 3} +coll.insert(doc) + +puts coll.count() coll.find().each { |doc| puts doc.inspect } diff --git a/lib/mongo/db.rb b/lib/mongo/db.rb index a3f6a64..214ebe1 100644 --- a/lib/mongo/db.rb +++ b/lib/mongo/db.rb @@ -112,7 +112,7 @@ module XGen doc = db_command(:count => collection, :query => selector) o = doc['ok'] 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 def drop_index(collection, name)