Details
-
Question
-
Resolution: Done
-
Major - P3
-
None
-
None
-
None
-
None
Description
Non background index build -
{a:[2,3]}document is partially indexed before being dropped at the end of the index build. As a result,
{a:2}document is also marked as a dup and dropped.
> c.drop()
|
true
|
> c.save( {a:3} );
|
> c.save( {a:[2,3]} );
|
> c.save( {a:2} );
|
> c.ensureIndex( {a:1}, {unique:true,dropDups:true} )
|
> c.find()
|
{ "_id" : ObjectId("4f277e3e2e17f5bc7039cd20"), "a" : 3 }
|
Background index build -
{a:[2,3]}document is dropped as soon as indexing is attempted, as a result
{a:2}gets inserted.
> c.drop()
|
true
|
> c.save( {a:3} );
|
> c.save( {a:[2,3]} );
|
> c.save( {a:2} );
|
> c.ensureIndex( {a:1}, {unique:true,dropDups:true,background:true} )
|
> c.find()
|
{ "_id" : ObjectId("4f277e782e17f5bc7039cd24"), "a" : 3 }
|
{ "_id" : ObjectId("4f277e7d2e17f5bc7039cd26"), "a" : 2 }
|