how to change all documents type from object to array in mongoose code example
Example: mongoose modify all elements in array
// Playground: https://mongoplayground.net/p/-TgGWwBd5l-
db.collection.update({
"_id": "password"
},
{
"$inc": {
"waitlist.$[].queue_place": -1
}
})
// Database
/*
[
{
"_id": "password",
"waitlist": [
{
"_id": "adasd",
"queue_place": 123
},
{
"_id": "ada43sd",
"queue_place": 2
}
]
}
]
*/