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

时间:2018-12-23 12:41:03

标签: mongodb

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

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
}

0 个答案:

没有答案