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

cant append for subdocument level 2

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

      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 Unassigned
            Reporter:
            abdelouahab84 abdelouahab
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: