I was trying to use the count() Mongodb feature (db.collection_name.count({data:value}) using the Ruby Driver. I tried using de collection.count method, but it don’t accept any parameters.
I checked the collection.count() method docs, it only returns the total amount of objects in the collection, where is no way you can pass a “filter” parameter to this method.
Is it possible use the count() Mongodb feature with filter parameters in some other way?
From the shell (command-line), you can do the following:
db.collection.find({ data : value}).count()Obviously, you’ll have to do something similar with Ruby, but it should be pretty straightforward.