javascript - 如何删除子子文档mongoosejs中的元素
问题描述
如何删除该特定用户的“book”“id_book = 8522”的“id_extra = 8523”的“extras”?,我目前使用mongoosejs但我没有成功,我尝试了很多东西,但我尝试的是工作到嵌套文档的第一级。
{
"_id":{
"$oid":"5e32fce08919b53ad66cf694"
},
"user_id":{
"$numberInt":"258787"
},
"username":"daaaa",
"firstname":"davide",
"api_key":"7b031c21edf1237c554867622ad1154f",
"books":[
{
"_id":{
"$oid":"5e356323a0ef6319ebb60162"
},
"id_book":{
"$numberInt":"8522"
},
"blob_annotation":null,
"extra_id":{
"$numberInt":"995176"
},
"extras":[
{
"_id":{
"$oid":"5e356324a0ef6319ebb60163"
},
"id_extra":{
"$numberInt":"8523"
},
"type":"gallery_audio",
"label":"Inverno a Boscodirovo"
},
{
"_id":{
"$oid":"5e356324a0ef6319ebb60164"
},
"id_extra":{
"$numberInt":"8524"
},
"type":"gallery_audio",
"label":"Storia di Primavera"
}
],
"raccolte":[
]
}
],
}
解决方案
推荐阅读
- c# - Unity:从非活动的游戏对象访问脚本?
- vb.net - 验证/刷新 Google API 访问令牌并避免“文件正在使用”异常?
- c# - MailKit 我没有从正确的发件人那里收到
- eslint - 如何配置 TypeScript ESLint 在不提供返回时推断 void
- machine-learning - 对也有分类标签的数据进行聚类的方法?
- c++ - exe文件打不开
- html - 使用标签从 Firebase 存储下载文件
- javascript - 如何检查元素的“之前”伪选择器是否具有与之关联的特定样式?
- c++ - 寻路算法没有找到最短路径
- selenium - 如何在詹金斯中对失败的机器人框架测试用例实现重新运行