-
Type: Task
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Aggregation Framework, Querying
-
Query
I was checking the sanity of how we have been merging missing and null using {$lte: ['$foo', null]}. On the bright side, it works, on the down side it appears that minKey is > maxKey (and all other values).
> db.mk.find() { "_id" : ObjectId("5dd2faf88a7fad5be8c370d0"), "max" : { "$maxKey" : 1 }, "min" : { "$minKey" : 1 } } > db.mk.aggregate({$project: {min:1, max:1, out: {$lt: ['$min', '$max']}}}) { "_id" : ObjectId("5dd2faf88a7fad5be8c370d0"), "max" : { "$maxKey" : 1 }, "min" : { "$minKey" : 1 }, "out" : false } > db.mk.aggregate({$project: {min:1, max:1, out: {$gt: ['$min', '$max']}}}) { "_id" : ObjectId("5dd2faf88a7fad5be8c370d0"), "max" : { "$maxKey" : 1 }, "min" : { "$minKey" : 1 }, "out" : true }
It appears related to this:
https://github.com/mongodb/mongo/blob/990b2ef30d7b8fa4db6af6d79da80e3664df9c21/src/mongo/bson/bsontypes.h#L67
My assumption is that somewhere we are treating BSONType as unsigned, so that -1 becomes MAX_INT.
- duplicates
-
SERVER-19171 Shell does not always use extended JSON Shell Syntax
- Closed