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

Don't write "hidden: false" to the index catalog when createIndexes specifies it explicitly

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.4.0-rc5, 4.7.0
    • Component/s: Indexing
    • Labels:
    • Backwards Compatibility:
      Minor Change
    • Operating System:
      ALL
    • Backport Requested:
      v4.4
    • Steps To Reproduce:
      Hide

      > 
      > db.runCommand({createIndexes: "test", indexes: [{key: {y: 1}, name: "y", hidden: false}]})
      {
      	"createdCollectionAutomatically" : true,
      	"numIndexesBefore" : 1,
      	"numIndexesAfter" : 2,
      	"ok" : 1
      }
      > db.runCommand({listIndexes: "test"})
      {
      	"cursor" : {
      		"id" : NumberLong(0),
      		"ns" : "test.test",
      		"firstBatch" : [
      			{
      				"v" : 2,
      				"key" : {
      					"_id" : 1
      				},
      				"name" : "_id_"
      			},
      			{
      				"v" : 2,
      				"key" : {
      					"y" : 1
      				},
      				"name" : "y",
      				"hidden" : false
      			}
      		]
      	},
      	"ok" : 1
      }
      >
      

      Show
      > > db.runCommand({createIndexes: "test", indexes: [{key: {y: 1}, name: "y", hidden: false}]}) { "createdCollectionAutomatically" : true, "numIndexesBefore" : 1, "numIndexesAfter" : 2, "ok" : 1 } > db.runCommand({listIndexes: "test"}) { "cursor" : { "id" : NumberLong(0), "ns" : "test.test", "firstBatch" : [ { "v" : 2, "key" : { "_id" : 1 }, "name" : "_id_" }, { "v" : 2, "key" : { "y" : 1 }, "name" : "y", "hidden" : false } ] }, "ok" : 1 } >
    • Sprint:
      Query 2020-05-18

      Description

      If an index is created with the index spec attribute "hidden: false" it should be accepted but not written to the index catalog. Omitting the field is equivalent and will allow MongoDB server versions <= 4.2 to load the catalog.

        Attachments

          Activity

            People

            Assignee:
            ruoxin.xu Ruoxin Xu
            Reporter:
            james.wahlin James Wahlin
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: