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

Update doesn't support "$"s in the field (not at the start)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 2.0.6
    • 2.5.2
    • Write Ops
    • None
    • n/a
    • ALL

    Description

      Added this in case it's not fixed in later mongodb releases (and I didn't see anything to suggest that it was)

      1] This documentation page suggests that "$" characters should be allowed in the fieldname: http://www.mongodb.org/display/DOCS/Legal+Key+Names

      But:

      mongos> b = { "x": { "string $ string": "test" }}
      { "x" :

      { "string $ string" : "test" }

      }
      mongos> db.alex.update(

      { "_id" : ObjectId("5097edd36ab51b0eece55bb8")}

      ,{$set:b},true)
      not okForStorage

      2] (This isn't just a shell thing, the issue was first noticed from the Java driver with equivalent code)

      3] Note that it only occurs when the field is nested, eg the following works:

      mongos> b =

      { "string $ string": "test" } { "string $ string" : "test" }

      mongos> db.alex.update(

      { "_id" : ObjectId("5097edd36ab51b0eece55bb8")}

      ,{$set:b},true)
      mongos>

      4] Note also that saving/inserting etc works fine, it's just for "update"

      Attachments

        Issue Links

          Activity

            People

              scotthernandez Scott Hernandez (Inactive)
              apiggott@ikanow.com Alex Piggott
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: