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

    XMLWordPrintable

    Details

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

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

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: