Description
If an explicit array field mod and a positional mod reference the same field, the numeric mod currently wins out. Generally when (non positional) mods may conflict we uassert instead of allowing one to trump the other. We might consider adopting a policy that is similar to that.
Test:
c = db.c;
|
c.drop();
|
|
|
c.save( { a:[ 1 ] } );
|
// The 'a.0' update wins out here:
|
c.update( { a:1 }, { $set:{ 'a.0':2, 'a.$':3 } } );
|
printjson( c.find().toArray() );
|