I want to replace an array field in document that has value of null to an empty array []. I tried this query but it's not working. Please help.
Basically I want testArray: null to be testArray: []
db.myTestCollection.aggregate( { "_id": ObjectId('1120191011212112') },
[ { $set: { testArray: { $ifNull: [ { $concatArrays: [ "$testArray", [] ] } ] } } }
])