Answer the question
In order to leave comments, you need to log in
How to remove object from mongodb?
How can I remove list with id 4?
let services = {
"1" : {
"list" : {
"4" : {
"id" : 4,
"desc" : "Lore ipsum",
"price" : 30,
"min" : 100,
"max" : 5000
},
"25" : {
"id" : 25,
"desc" : "Lore ipsum",
"price" : 50,
"min" : 100,
"max" : 5000
}
}
}
}
Answer the question
In order to leave comments, you need to log in
not entirely clear what the collection schema looks like, but $unset
https://docs.mongodb.com/manual/reference/operator...
Service.updateOne(
{ services: 1 /* * */ },
{ $unset: { '4': '' } }
)
// не сработает, потому что я не понимаю, как именно выделить этот документ
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question