carlosparamio / mongo_odm

Flexible persistence module for any Ruby class to MongoDB
http://github.com/carlosparamio/mongo_odm
MIT License
41 stars 8 forks source link

MongoODM::Criteria delegates count to Collection instead of Cursor #13

Open michalkrause opened 13 years ago

michalkrause commented 13 years ago

It seems to me that MongoODM::Criteria delegates count method to Collection instead of Cursor in method_missing. The following code

User.find({ :active => true }).count

should return number of active users but returns count of documents in the collection instead.

carlosparamio commented 13 years ago

Sounds logical. I will check it and fix it. Thanks!

CodeMonkeySteve commented 12 years ago

I fixed this a while back in my fork, here: https://github.com/CodeMonkeySteve/mongo_odm/commit/f4a55fef6522f94feb50024192883fd4e74c7b48

Feel free to cherry-pick it.