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

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor - P4
    • Resolution: Fixed
    • 2.6.0-rc0
    • 2.6.0-rc1
    • Write Ops
    • None
    • ALL

    Description

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

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: