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

Updating deep nested array in embedded document error

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Critical - P2 Critical - P2
    • None
    • Affects Version/s: 3.3.3
    • Component/s: Querying
    • None
    • ALL
    • Hide

      db.collection.update(

      { "country_id" : 1, "stateinfo.state_id" : 2, "stateinfo.cityinfo.city_id" : 4 }

      ,
      {
      $set :

      { "stateinfo.cityinfo.$.status" : 20 }


      },
      false,
      true
      )

      Show
      db.collection.update( { "country_id" : 1, "stateinfo.state_id" : 2, "stateinfo.cityinfo.city_id" : 4 } , { $set : { "stateinfo.cityinfo.$.status" : 20 } }, false, true )

      We have a collection with country state city, while trying to update in deep nested array ie., city using positional operator it shows error using to many positional operator..
      In order to make the update, I need to know the position of the city document out of the following cities. but this is not a proper way to update can u pls bring the solution for this

        1. bug
          0.6 kB

            Assignee:
            Unassigned Unassigned
            Reporter:
            shibish shibimukesh
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: