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

$push operator allows dots in subdocument key names

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major - P3 Major - P3
    • None
    • 2.4.10
    • 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' } } } } }

    Description

      $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

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: