How to change a type of a array using runCommand

Hi @ MaBeuLux88!
Thanks for the answer. This solved my problem!
Here’s the complete code:

<ext:runCommand>
            <ext:command>
                {
                   aggregate: "driver_delivery_route",
                   pipeline: [
                      {
                        '$project': {
                          'orders': {
                            '$map': {
                              'input': '$orders',
                              'in': {
                                '_id': '$$this'
                              }
                            }
                          }
                        }
                      }, {
                        '$merge': {
                          'into': 'driver_delivery_route',
                          'on': '_id',
                          'whenMatched': 'merge',
                          'whenNotMatched': 'fail'
                        }
                      }
                    ],
                   cursor: { }
                }
            </ext:command>
</ext:runCommand>
1 Like