I have a mongodb collection with thousands of documents. I have different steps in this collection and their steps status is completed. I want to update particular steps status from Completed to Open. For example, I want to update status to "Open"only for steps three and four and the document overAllStatus to Started. I want to do this where "executionId" is "20200622104036256".
My documents/json structure. Collection name order_status
{
"_id" : ObjectId("5ef03d8f5f5775000921e5b9"),
"executionId" : "20200622104036256",
"stateNumber" : "123456",
"overAllStatus" : "Completed",
"steps" : [{
"name" : "Step One",
"status" : "Completed"
}, {
"name" : "Step Two",
"status" : "Completed"
}, {
"name" : "Step Three",
"status" : "Completed"
}, {
"name" : "Step Four",
"status" : "Completed"
}],
"ABC" : {
"status" : "Completed"
}
}
After i execute the shell update script/query. All the documents where the "executionId" is "20200622104036256" will be looking as below
{
"_id" : ObjectId("5ef03d8f5f5775000921e5b9"),
"executionId" : "20200622104036256",
"stateNumber" : "123456",
"overAllStatus" : "Started",
"steps" : [{
"name" : "Step One",
"status" : "Completed"
}, {
"name" : "Step Two",
"status" : "Completed"
}, {
"name" : "Step Three",
"status" : "Open"
}, {
"name" : "Step Four",
"status" : "Open"
}],
"ABC" : {
"status" : "Completed"
}
}