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

Can create indexes on non-insertable fields (i.e. beginning with '$')

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor - P4
    • Resolution: Fixed
    • None
    • 2.5.4
    • Index Maintenance
    • Minor Change
    • ALL
    • Hide

      > coll.ensureIndex({'x.$a':1})

      Show
      > coll.ensureIndex({'x.$a':1})

    Description

      Can create indices, for example:

      > coll.ensureIndex({'x.$a':1})
      > coll.getIndexes()
      [
      	{
      		"v" : 1,
      		"name" : "_id_",
      		"ns" : "test.t",
      		"key" : {
      			"_id" : 1
      		}
      	},
      	{
      		"v" : 1,
      		"ns" : "test.t",
      		"key" : {
      			"x.$a" : 1
      		},
      		"name" : "x.$a_1"
      	}
      ]

      You can also create an index that contains an empty field name, i.e.: "x..a"

      As you cannot save/insert/upsert a field with that name, it seems like incorrect behavior to be able to index on it.

      Attachments

        Issue Links

          Activity

            People

              amalia.hawkins@10gen.com Amalia Hawkins
              amalia.hawkins@10gen.com Amalia Hawkins
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: