If there is no array match in the query portion of an update, any $ field name is copied directly to the result document.
c = db.c;
c.drop();
c.save( {} );
c.update( {}, { $set:{ 'a.$':5 } } );
printjson( c.findOne() );
result
{ "_id" : ObjectId("501840bc20fa57fe9c46e970"), "a" : { "$" : 5 } }
- is duplicated by
-
SERVER-5371 update with positional operator does not validate existence of a positional match
- Closed
- is related to
-
SERVER-7186 Batched oplog application increases frequency of idempotency violations
- Closed
-
SERVER-4713 Upsert with $-positional operator can create bad documents
- Closed