mongodb我如何只能更新一个嵌套文档

时间:2019-12-30 17:42:21

标签: javascript node.js mongodb

如果对象ID不匹配,我需要在第一个对象更新中添加地址,然后插入地址数组。

{
    "_id" : ObjectId("5e0707d856cd5a1abcb7832f"), 
    "address" : [ 
        {
            "_id" : ObjectId("5e0727e87a21f51d3c5bf3bb"),
            "fulladdress" : "aa,
            "location" : "aa",
            "name" : "aa",
            "landMark" : "aa"
        },
        {
            "_id" : ObjectId("5e0727e87a21f51d3c5bf3bb"),
            "fulladdress" : "bb,
            "location" : "bb",
            "name" : "bb",
            "landMark" : "bb"
        }
    ], 
} 

0 个答案:

没有答案