I have a document like following in my stocks collection in mongodb.
{ _id: 'xRMuRBhqRLgASyQyW',
History:
[ { orderId: '12032017001877',
status: 'COMPLETED',
},
{ orderId: '22122017002450',
status: 'PROCESSED',
},
{ orderId: '22122018002450',
status: 'DEPOSIT',
}
]
}
I want to iterate through all document in stocks
collection and add a field flag: true
if status is not 'PROCESSED'
.