mongo_odm icon indicating copy to clipboard operation
mongo_odm copied to clipboard

MongoODM::Criteria delegates count to Collection instead of Cursor

Open michalkrause opened this issue 13 years ago • 2 comments

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.

michalkrause avatar Apr 04 '11 16:04 michalkrause

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

carlosparamio avatar Apr 05 '11 16:04 carlosparamio

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

Feel free to cherry-pick it.

CodeMonkeySteve avatar Oct 16 '11 20:10 CodeMonkeySteve