Hello.
I would like to modify my array’s type from ObjectId to Object, copying the values of each element of the array into a new object. I need to do this using liqbase and I believe the best way would be using runCommand. The big problem is that I can’t use the element’s expression as a value in the new object, like this:
<ext:command>
{
update: "driver_delivery_route",
updates: [
{
q: {_id: ObjectId('61f82b33c0b9053da2197759')},
u: {
$set: { "orders.$[element]": {
_id: "orders.$[element].somethingMaybe" // this is always interpreted like string
} }
},
arrayFilters: [ { "element": { $ne: null } } ]
}
]
}
</ext:command>
current:
{
"orders": [ObjectId('....'), ObjectId('....')]
}
expected:
{
"orders": [{_id: ObjectId('....')}, {_id: ObjectId('....')}]
}
Does anyone know how to do this or have another suggestion to solve this problem?
Thank you!