[SERVER-3370] $inc with implicit subfield creation on documents with similar keynames and hyphens corrupts document Created: 05/Jul/11  Updated: 12/Jul/16  Resolved: 01/Aug/11

Status: Closed
Project: Core Server
Component/s: Write Ops
Affects Version/s: 1.8.2
Fix Version/s: 1.9.2

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

Reproduced on 32bit and 64bit servers. Unable to reproduce on MongoDB shell on MongoDB.org though.


Operating System: ALL
Participants:

 Description   

> db.example.remove()
> db.example.save({ 'all' : {}, 'all-copy' : {}})
> db.example.update({}, { '$inc' : { 'all.t' : 1, 'all-copy.t' : 1 }})
> db.example.find()
{ "_id" : ObjectId("4dc8842c8c18470a86477303"), "all" : { }, "all-
copy" :

{ "t" : 1 }

, "all" : { } }

As you can see, the document is now corrupt. Somehow there are two values with exactly the same key name, and the increment action did not complete. It has something to do with the hyphen and similar keynames, because removing the hyphen fixes the problem, and changing the keynames to something not so similar fixes the problem..



 Comments   
Comment by auto [ 16/Dec/11 ]

Author:

{u'login': u'astaple', u'name': u'Aaron', u'email': u'aaron@10gen.com'}

Message: SERVER-3370 SERVER-3218 backport lexNumCmp fixes to 1.8
Branch: v1.8
https://github.com/mongodb/mongo/commit/e82f9ddc53a4fe24a40f190b45dc25b7ed88ed96

Comment by auto [ 31/Jul/11 ]

Author:

{u'login': u'astaple', u'name': u'Aaron', u'email': u'aaron@10gen.com'}

Message: SERVER-3370 partition lexNumCmp comparisions with dot characters
Branch: master
https://github.com/mongodb/mongo/commit/44ca61eafb112231367f012f80b38d66feadd055

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