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

    • Minor Change
    • ALL
    • v4.4
    • 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 } >
    • Query 2020-05-18

      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.

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

              Created:
              Updated:
              Resolved: