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

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Major - P3
    • Resolution: Duplicate
    • None
    • None
    • Querying
    • None

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

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: