gem install mongo
Hi Mahmood
Thanks for pointing this out. I've looked into it, and found that RubyGems removed a dummy Date class in version 2.4, which is bundled with Ruby 2.2.0, as per this commit.
I just added a line to require 'date' in our Date class to account for this and released as bson 3.0.1
You shouldn't have to explicitly require 'bson' as it's a dependency of the mongo gem.
So try out doing the following in IRB now that bson 3.0.1 is released
require 'mongo'
and let me know if it works for you.
CORRECTION:
'DBPointer' in the BSON spec is deprecated. The DBRef type is not deprecated but is not currently available in the bson gem 2.0. It will be added soon for backwards compatibility.
Thanks and let me know if you have any more questions!
Emily
c = Mongo::Client.new(["127.0.0.1:27017"]).use("test")
D, [2015-04-23T01:51:00.677707 #1467] DEBUG -- : MONGODB | COMMAND | namespace=admin.$cmd selector={:ismaster=>1} flags=[] limit=-1 skip=0 project=nil | runtime: 0.3562ms
D, [2015-04-23T01:51:10.678599 #1467] DEBUG -- : MONGODB | COMMAND | namespace=admin.$cmd selector={:ismaster=>1} flags=[] limit=-1 skip=0 project=nil | runtime: 0.4640ms
D, [2015-04-23T01:51:20.679812 #1467] DEBUG -- : MONGODB | COMMAND | namespace=admin.$cmd selector={:ismaster=>1} flags=[] limit=-1 skip=0 project=nil | runtime: 0.3400ms
D, [2015-04-23T01:51:30.684039 #1467] DEBUG -- : MONGODB | COMMAND | namespace=admin.$cmd selector={:ismaster=>1} flags=[] limit=-1 skip=0 project=nil | runtime: 0.3641ms
constantly
is this normal?
Mongo::Logger.logger.level = Logger::WARN
Hi Michael
When you call #find on a collection, it doesn't actually execute the query; it returns a Collection::View object on which #count can be called. The #find method is used to define the count criteria.
For example, see this documentation:
http://docs.mongodb.org/ecosystem/tutorial/ruby-driver-tutorial/#additional-query-operations
Thus, you aren't doing a query and a count. Calling #count just runs the count command with the defined query.
Regarding the performance difference; Are you running #count with the same exact criteria in the old driver as you are in the new driver? Would you mind sending me the lines of code you are using to do the count in both the new and old drivers?
Thanks
Emily