2020-12-26

MongoDB - How to update a doubly nested array of objects

 db.COLLECTION.update(

    {

        "any_field": "any_value"

    }

    , {$set: {

        "parent.$[x].child.$[xx].grandchild": "any_value"

    }}

    , {

        arrayFilters: [

            {"x.any_matching_field": "any_value"}

            , {"xx.any_matching_field": "any_value"}

        ]

        , multi: true

        , upsert: false

    }

);

No comments:

Post a Comment