$push operator allows dots in subdocument key names

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.4.10
    • Component/s: Internal Code
    • None
    • Windows
    • Hide

      Introduce this code into an update call:

      {
       '$push': {
        'foo3': {
         'test': {
          'blam.0': {
      	 'tee': 'haw'
      	}
         }
        }
       }
      }
      
      Show
      Introduce this code into an update call: { '$push' : { 'foo3' : { 'test' : { 'blam.0' : { 'tee' : 'haw' } } } } }
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      $push operator allows database updates with dots (".") in the keys on subdocuments.

      I found this issue when I was coding today in PHP, then reproduced it in MongoVue on a Windows 7 system.

      Using $set, I very properly get the following error:
      "Error in performing Update
      Safemode detected an error 'not okForStorage'. (Response was

      { "err" : "not okForStorage", "code" : 12527, "n" : 0, "connectionId" : 853, "ok" : 1.0 }

      ).

      Using $push, the update succeeds, but later edits (properly) yield the following message:
      Error - unable to modify value
      Element name 'blam.0' is not valid because it contains a '.'.
      Type: MongoDB.Bson.BsonSerializationException

            Assignee:
            Unassigned
            Reporter:
            Alex Parise
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: