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

Updating deep nested array in embedded document error

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Critical - P2 Critical - P2
    • None
    • 3.3.3
    • 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 )

    Description

      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

      Attachments

        1. bug
          0.6 kB

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: