-
Type: New Feature
-
Resolution: Duplicate
-
Priority: Minor - P4
-
None
-
Affects Version/s: 1.7.1
-
Component/s: Index Maintenance
-
None
-
Environment:All
The documentation states :
"When a document is saved to a collection with unique indexes, any missing indexed keys will be inserted with null values. Thus, it won't be possible to insert multiple documents missing the same indexed key.".
This is very unpractical in a lot of situations and Mongo should offer the option to allow a field indexed with a uniquess constraint to be null for more than one document.
Something like ensureIndex(
{firstname: 1, lastname: 1},
{unique: true, multipleNulls:true}would be nice and it should be fairly trivial to add.