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

Creating Index with invalid properties

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Duplicate
    • Affects Version/s: 2.6.4
    • Fix Version/s: None
    • Component/s: Indexing
    • Labels:
      None
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      db.test.save({name : 'mongodb', date: new Date()})
      WriteResult({ "nInserted" : 1 })
      > db.test.save({name : 'mongodb2'})
      WriteResult({ "nInserted" : 1 })
      > db.test.find()
      { "_id" : ObjectId("55f8762792a0ee661e65b90b"), "name" : "mongodb", "date" : ISODate("2015-09-15T19:48:55.803Z") }
      { "_id" : ObjectId("55f8763192a0ee661e65b90c"), "name" : "mongodb2" }
      > db.test.ensureIndex({date :1}, {sparsse : true})
      {
      	"createdCollectionAutomatically" : false,
      	"numIndexesBefore" : 1,
      	"numIndexesAfter" : 2,
      	"ok" : 1
      }
      > db.test.getIndexes()
      [
      	{
      		"v" : 1,
      		"key" : {
      			"_id" : 1
      		},
      		"name" : "_id_",
      		"ns" : "easytaxi_driver_restore.test"
      	},
      	{
      		"v" : 1,
      		"key" : {
      			"date" : 1
      		},
      		"name" : "date_1",
      		"ns" : "easytaxi_driver_restore.test",
      		"sparsse" : true
      	}
      ]
      

      Show
      db.test.save({name : 'mongodb', date: new Date()}) WriteResult({ "nInserted" : 1 }) > db.test.save({name : 'mongodb2'}) WriteResult({ "nInserted" : 1 }) > db.test.find() { "_id" : ObjectId("55f8762792a0ee661e65b90b"), "name" : "mongodb", "date" : ISODate("2015-09-15T19:48:55.803Z") } { "_id" : ObjectId("55f8763192a0ee661e65b90c"), "name" : "mongodb2" } > db.test.ensureIndex({date :1}, {sparsse : true}) { "createdCollectionAutomatically" : false, "numIndexesBefore" : 1, "numIndexesAfter" : 2, "ok" : 1 } > db.test.getIndexes() [ { "v" : 1, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "easytaxi_driver_restore.test" }, { "v" : 1, "key" : { "date" : 1 }, "name" : "date_1", "ns" : "easytaxi_driver_restore.test", "sparsse" : true } ]

      Description

      When I created a index with a non existing property name by mistake I saw the "inexistent" property at getIndexes() property of my collection.

      Is this behaviour expected?

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              adamobr Adamo Tonete
              Participants:
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: