-
Type: Bug
-
Resolution: Won't Fix
-
Priority: Minor - P4
-
None
-
Affects Version/s: 2.4.7, 2.5.4
Prepending description from SERVER 9548
> db.docs.drop() > for (var i=0; i<10; i++) { db.docs.insert({number: i}) } > db.docs.find() { "_id" : ObjectId("51834d678d284e5c5e3ea7e3"), "number" : 0 } { "_id" : ObjectId("51834d678d284e5c5e3ea7e4"), "number" : 1 } { "_id" : ObjectId("51834d678d284e5c5e3ea7e5"), "number" : 2 } { "_id" : ObjectId("51834d678d284e5c5e3ea7e6"), "number" : 3 } { "_id" : ObjectId("51834d678d284e5c5e3ea7e7"), "number" : 4 } { "_id" : ObjectId("51834d678d284e5c5e3ea7e8"), "number" : 5 } { "_id" : ObjectId("51834d678d284e5c5e3ea7e9"), "number" : 6 } { "_id" : ObjectId("51834d678d284e5c5e3ea7ea"), "number" : 7 } { "_id" : ObjectId("51834d678d284e5c5e3ea7eb"), "number" : 8 } { "_id" : ObjectId("51834d678d284e5c5e3ea7ec"), "number" : 9 } > db.docs.count() 10
> db.docs.find().max({number: 4}) { "_id" : ObjectId("51834d678d284e5c5e3ea7e3"), "number" : 0 } { "_id" : ObjectId("51834d678d284e5c5e3ea7e4"), "number" : 1 } { "_id" : ObjectId("51834d678d284e5c5e3ea7e5"), "number" : 2 } { "_id" : ObjectId("51834d678d284e5c5e3ea7e6"), "number" : 3 }
So far so good.
> db.docs.find().max({number: 4}).count() 10
I would like this count to return 4. Instead it returns 10.
----------
(original description)
see jstests/testminmax.js
wrong result
if this is hard to fix and mainly for mongos, we could uassert "not implemented", but we can't return wrong answer.
- duplicates
-
SERVER-9548 Support $min/max in count command
- Closed