繁体   English   中英

Mongodb:UpdateMany不更新嵌套数组数据

[英]Mongodb: UpdateMany not update nested array data

我尝试更新许多数据,但没有更新。 我正在使用这样的命令

db.transactions.updateMany({"request_by.0.userId":"060dcaf49c13e9c380ebfccd"},{$set: {"request_by.0.city":"aaa"}});

结果

{ "acknowledged" : true, "matchedCount" : 2, "modifiedCount" : 0 }

我的交易收集数据

{
    "_id": "9e2dfeec3f31db6415108a3d",
    "request_by": [{
        "userId": "060dcaf49c13e9c380ebfccd",
        "email": "derp@gmail.com",
        "tel": "0128371827",
        "name": "Derp the joker",
        "role": "guest",
        "iat": 1545564382,
        "exp": 1545582382
    }],
    "status": "active",
    "invoice": "2018122318410976",
    "created_at": "2018-12-23T11:41:09.203Z",
    "updated_at": "2018-12-23T11:41:09.203Z",
    "__v": 0
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM