i do not know if this has answer or not but i couldn't fix my issue .
Shift.updateOne({
$and: [{phone: number}, {statusSH: "open"}, {
'order.startTime': start,
'order.finishTime': finish
},{'order.orders.5.stat':"false"}]
},{'$set': {'order.orders.5.stat': "true"}},function (error,update) {
if (update){
}
});
this 'order.orders.5.stat' works fine . but i don't know how i can use dynamic index . like if i have a "var index" where should i add that to query . it seems if i 'order.orders.'+index+'.stat' i get error .
All helps will be appreciated. Thank You.
Edit :
doc should be like this
{
"_id": "5f52745e77abf55e80228379",
"phone": "09898989666",
"final": true,
"statusSH": "open",
"created_time": "1599239262",
"__v": 0
"order": {
"startTime": "139912292135",
"finishTime": "139912292240",
"orders": [
{
"_id": "5f52745e77abf55e8022837a",
"stat": "false",
},
{
"_id": "5f52745e77abf55e8022837b",
"stat": "false",
}
]
}
}