Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-33877

Inconsistent results when using MinKey/MaxKey in comparison operator when an index is present

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • None
    • Query

      > 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 } }
      

            Assignee:
            backlog-server-query Backlog - Query Team (Inactive)
            Reporter:
            nicholas.zolnierz@mongodb.com Nicholas Zolnierz
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: