-
Type: Question
-
Resolution: Duplicate
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
Should it be possible to enforce uniqueness of an object within an array within a single document using a unique index?
For instance:
db.foo.save( { a : [
{ b : 1 } ] } )
db.foo.ensureIndex({_id: 1, 'a.b': 1},
);
// This succeeds. Should it fail?
db.foo.update({}, { '$push' : { 'a':
} });