[SERVER-6669] update lacking positional match creates bad document Created: 31/Jul/12  Updated: 11/Jul/16  Resolved: 27/Dec/12

Status: Closed
Project: Core Server
Component/s: Write Ops
Affects Version/s: 2.0.6, 2.2.0-rc0
Fix Version/s: 2.3.2

Type: Bug Priority: Major - P3
Reporter: Aaron Staple Assignee: Aaron Staple
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-5371 update with positional operator does ... Closed
Related
is related to SERVER-7186 Batched oplog application increases f... Closed
is related to SERVER-4713 Upsert with $-positional operator can... Closed
Operating System: ALL
Participants:

 Description   

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 } }



 Comments   
Comment by auto [ 27/Dec/12 ]

Author:

{u'date': u'2012-12-22T21:34:06Z', u'email': u'aaron@10gen.com', u'name': u'aaron'}

Message: SERVER-6669 SERVER-4713 Validate that a positional match is found before applying an update mod with the positional operator.
Branch: master
https://github.com/mongodb/mongo/commit/f498a5c235e4da255d9cfea336b66b9c30403706

Comment by Aaron Staple [ 16/Aug/12 ]

Tentatively scheduling for 2.3.x.

Generated at Thu Feb 08 03:12:21 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.