I have two documents as in db bookingDetails" as:
{
"_id":ObjectId("12jj21jan21jdo3kan2idm11"),
"book_status":"BOOKED",
"reservation":false,
}
{
"_id":ObjectId("12jj21jan21jdo3kan2idm11"),
"book_status":"ACCEPTED",
"reservation":true,
}
update both of the document with multiple queries.
I am trying as,
bookingDetails.updateMany(
{
"book_status":"ACCEPTED",
},
{
$set:{
"book_status":"DONE"
}
}
)
bookingDetails.updateMany(
{
"book_status":"BOOKED",
},
{
$set:{
"book_status":"DONE"
}
}
)
But this method is repetitive which increases load on db. Is there any way that it can be optimized?
Please let me know if anyone needs any further information.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.