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

cant append for subdocument level 2

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical - P2
    • Resolution: Duplicate
    • 2.4.3
    • None
    • Querying
    • None
    • Windows, Linux.
    • ALL

    Description

      It seems that i can go further than one subdocument if i want to add it dynamicaly, here is the code:

      db.users.update(

      {"pup.cmn.id":id}

      , {"$addToSet":{"pup.cmn":

      {"abus":email}

      }})
      this give error:

      OperationFailure: can't append to array using string field name: cmn
      then, if i add positional element i get this:

      db.users.update(

      {"pup.cmn.id":id}

      , {"$addToSet":{"pup.$.cmn":

      {"abus":email}

      }})

      "cmn" :
      [
      {
      "fto" : ObjectId("5190e8a53a5f3a0c102af045")
      "id" : "14.05.2013 12:29:53"
      },
      {
      "abus" : "u...@example.com"
      }
      ]
      so as you can see, it will add it in the same level, and i dont want that, because the application will get errors.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              abdelouahab84 abdelouahab
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: