-
Type: Improvement
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Index Maintenance
-
None
Running MongoDB 2.6.8, I get:
> db.notification.getIndexes()[1] { "v" : 1, "key" : { "_cls" : 1, "membership" : 1 }, "ns" : "closeio.notification", "name" : "_cls_1_membership_1", "background" : false, "dropDups" : false } > db.notification.ensureIndex({ _cls: 1, membership: 1 }) { "numIndexesBefore" : 14, "note" : "all indexes already exist", "ok" : 1 } > db.notification.ensureIndex({ _cls: 1, membership: 1 }, { background: true }) { "numIndexesBefore" : 14, "note" : "all indexes already exist", "ok" : 1 } > db.notification.ensureIndex({ _cls: 1, membership: 1 }, { whatever: true }) { "ok" : 0, "errmsg" : "Index with name: _cls_1_membership_1 already exists with different options", "code" : 85 } > db.notification.ensureIndex({ _cls: 1, membership: 1, whatever:1 }, { whatever: true }) { "createdCollectionAutomatically" : false, "numIndexesBefore" : 14, "numIndexesAfter" : 15, "ok" : 1 } > db.notification.getIndexes()[14] { "v" : 1, "key" : { "_cls" : 1, "membership" : 1, "whatever" : 1 }, "name" : "_cls_1_membership_1_whatever_1", "ns" : "closeio.notification", "whatever" : true }
1. Calling ensureIndex with an unsupported option shouldn't consider the spec different from the existing one (i.e. the error shouldn't occur).
2. Options that aren't supported shouldn't be stored on the index spec.
Do you agree?
- duplicates
-
SERVER-769 Validate top-level & index spec field names for the createIndexes command
- Closed