> db.g.save({a: 1})
|
> db.g.save({a: 1})
|
> db.g.find()
|
{ "_id" : ObjectId("4cd05a0ae109fa5c133e277a"), "a" : 1 }
|
{ "_id" : ObjectId("4cd05a0be109fa5c133e277b"), "a" : 1 }
|
> db.g.ensureIndex({a: 1}, {unique: true, dropDups: true})
|
E11000 duplicate key error index: test.g.$a_1 dup key: { : 1.0 }
|
> db.g.find()
|
{ "_id" : ObjectId("4cd05a0ae109fa5c133e277a"), "a" : 1 }
|
If the user specifies dropDups: true, there's no reason for the server to assert. This is a problem in the drivers, where we check for assertions when creating indexes.
|