我是相当新的节点JS和MongoDB,我需要添加或更新有关MongoDB集合子文档如下:添加和MongoDB中更新子文档和节点JS(不含猫鼬)
{
"_id": "58286e49769e3729e895d239",
"id": "2",
"title": "Session Title",
"sessiondate": "2016-02-11T21:00:00.000Z",
"startTime": "14:30",
"endTime": "16:30",
"breakStartTime": "16:30",
"breakEndTime": "18:00",
"talks": [
{
"id": "3",
"title": "Android",
"speaker": {
"id": "1",
"name": "john doe",
"about": "about the speaker",
"photo": "https://pbs.twimg.com/profile_images/566353055788978177/dUy_ueY2.jpeg"
}
}
]
}
所有我找到的解决方案是使用猫鼬,在这个特定的项目中,我们决定不使用猫鼬,任何想法?
谢谢你的澄清,但我不明白到底是什么{A:1},{B:1 }的意思,同样的事情出现在文档https://mongodb.github.io/node-mongodb-native/api-generated/collection.html#update,我真的转储! –
正如我的示例所示,我需要添加新的对话或更新现有的对话。 –