Mongodb : Loop through array and update object field using ObjectId
in the following example I have a company named Colors Company that owns many shops { _id: ObjectId("78391283"), name: "Colors company", shops: [ {shopID: ObjectId("123456a1cb"), income: 0}, {shopID: ObjectId("2a1cb67890"), income: 0}, {shopID: ObjectId("2a1cb010111"), income: 0}, ... ], } I need…