[SERVER-33877] Inconsistent results when using MinKey/MaxKey in comparison operator when an index is present Created: 14/Mar/18  Updated: 06/Dec/22  Resolved: 14/Mar/18

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Nicholas Zolnierz Assignee: Backlog - Query Team (Inactive)
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-18341 Matcher returns false positives in co... Closed
Assigned Teams:
Query
Participants:

 Description   

> db.test.find()
{ "_id" : ObjectId("5aa9341ad89e0643662e2f30"), "a" : { "$minKey" : 1 } }
> db.test.getIndexes()
[
	{
		"v" : 2,
		"key" : {
			"_id" : 1
		},
		"name" : "_id_",
		"ns" : "test.test"
	}
]
> db.test.find({a: {$gt: MinKey}})
> db.test.createIndex({a: 1})
{
	"createdCollectionAutomatically" : false,
	"numIndexesBefore" : 1,
	"numIndexesAfter" : 2,
	"ok" : 1
}
> db.test.find({a: {$gt: MinKey}})
{ "_id" : ObjectId("5aa9341ad89e0643662e2f30"), "a" : { "$minKey" : 1 } }



 Comments   
Comment by Kyle Suarez [ 14/Mar/18 ]

Yeah, definitely feels like the behavior in the absence of the index (that is, excluding the minKey value) is correct.

Generated at Thu Feb 08 04:34:51 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.