Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-3370

$inc with implicit subfield creation on documents with similar keynames and hyphens corrupts document

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.9.2
    • Affects Version/s: 1.8.2
    • Component/s: Write Ops
    • None
    • Environment:
      Reproduced on 32bit and 64bit servers. Unable to reproduce on MongoDB shell on MongoDB.org though.
    • ALL

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

            Assignee:
            aaron Aaron Staple
            Reporter:
            wouter Wouter
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: