cant append for subdocument level 2

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Critical - P2
    • None
    • Affects Version/s: 2.4.3
    • Component/s: Querying
    • None
    • Environment:
      Windows, Linux.
    • ALL
    • None
    • 0
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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.

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

                Created:
                Updated:
                Resolved: