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

v2.6.0-rc0 update $setOnInsert still saves invalid element names

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.6.0-rc1
    • Affects Version/s: 2.6.0-rc0
    • Component/s: Write Ops
    • None
    • ALL

      Release notes say: "Starting in MongoDB version 2.5.4, update operations no longer supports saving field names that contain a dot (.) or a field name that starts with a dollar sign ($)."

      There is a case where update still saves a field name with a dot (.).

      The steps:

      > db.test.drop()
      true
      
      > db.test.update({y : {"bad.1" : 1}}, {$setOnInsert : {x : 42}}, {upsert : true})
      WriteResult({
              "nMatched" : 0,
              "nUpserted" : 1,
              "nModified" : 0,
              "_id" : ObjectId("530a79b4f0b65d96ef21598a")
      })
      
      > db.test.find()
      { "_id" : ObjectId("530a79b4f0b65d96ef21598a"), "y" : { "bad.1" : 1 }, "x" : 42 }
      

      As a result, we have a new document which has a nested document with the element name with a dot: "bad.1".

            Assignee:
            scotthernandez Scott Hernandez (Inactive)
            Reporter:
            nightroman Roman Kuzmin
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: