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

Support same index definition but with different partial filter expressions

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Duplicate
    • None
    • None
    • None
    • None
    • ALL

    Description

      Currently, it's impossible to create an Index with the same definition (same keys) but a different partial than one that already exists in the collection.
      Trying to do it, produces the following error:
      The full response is

      {
      	"ok" : 0.0,
      	"errmsg" : "Index: {
      		v: 2,
      		key: {
      			prop: 1,
      			timestamp: -1
      		},
      		name: \"name1.prop\",
      		ns: \"db1.col1\",
      		partialFilterExpression: {
      			name: \"name1\"
      		}
      	}
      	already exists with different options: {
      		v: 2,
      		key: {
      			prop: 1,
      			timestamp: -1
      		},
      		name: \"name2.prop\",
      		ns: \"db1.col1\",
      		partialFilterExpression: {
      			name: \"name2\"
      		}
      	}",
      	"code" : 85,
      	"codeName" : "IndexOptionsConflict"
      }
      

      My indexes are "dynamic", i.e. they will be added to the collection as Documents are added to another collection. Being so, I need to later add these indexes, but this bug won't allow me so.
      Now, the only option is to make the index not partial, but I don't really like that, since it would probably use some unnecessary space.

      Attachments

        Issue Links

          Activity

            People

              backlog-server-query Backlog - Query Team (Inactive)
              LuisTAC Luis Torres Aguiar da Costa
              Votes:
              0 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: