test> db.things.drop()
|
true
|
test> db.things.save({"array": [ 1, 2, 3 ]})
|
test> db.things.save({"array": [ 2, 3, 4 ]})
|
test> db.things.createIndex({array: 1}, {unique: true, dropDups: true})
|
Invalid BSONObj size: -286331154 (0xEEEEEEEE) first element: _id: ObjectId('4ef8fc7f7797e97e21a8c7da')
|
but:
test> db.things.drop()
|
true
|
test> db.things.save({"array": [ 1, 2, 3 ]})
|
test> db.things.save({"array": [ 2, 3, 4 ]})
|
test> db.things.createIndex({array: 1}, {unique: true, dropDups: 1})
|
E11000 duplicate key error index: test.things.$array_1 dup key: { : 3.0 }
|
This only seems to happen if there are 2 or more duplicates in the array; with 1 duplicate, it works correctly with either true or 1 as argument to dropDups
|