-
Type:
Bug
-
Resolution: Works as Designed
-
Priority:
Major - P3
-
None
-
Affects Version/s: 3.7.4
-
Component/s: Shell
-
None
-
Query
-
ALL
-
None
-
None
-
None
-
None
-
None
-
None
-
None
charlie.swanson discovered the following weird (and seemingly incorrect) behavior with MinKey in the shell:
> db.foo.insert({x: MinKey})
WriteResult({ "nInserted" : 1 })
> db.foo.find()
{ "_id" : ObjectId("5aa9764861da7407ff9101f4"), "x" : { "$minKey" : 1 } }
> db.foo.findOne()
{ "_id" : ObjectId("5aa9764861da7407ff9101f4"), "x" : { "$minKey" : 1 } }
> db.foo.findOne().x
{ "$minKey" : 1 }
> db.foo.findOne().x == MinKey
true
> db.foo.findOne({}, {_id: 0}).x == MinKey
true
> db.foo.findOne({}, {_id: 0})
{ "x" : { "$minKey" : 1 } }
> db.foo.findOne({}, {_id: 0}) == {x: MinKey}
false
> db.foo.findOne({}, {_id: 0}) == { "x" : { "$minKey" : 1 } }
false
It seems like there's been weird behavior with this before, in SERVER-8246, but that was such a long time ago it seemed reasonable to open a new ticket.