Sam*_*ack 8 javascript mongodb nosql node.js mongodb-query
现在这是我得到的回应updateMany()
回复
[
{
"result": {
"n": 1,
"nModified": 1,
"opTime": {
"ts": "6870210161760272385",
"t": 23
},
"electionId": "7fffffff0000000000000017",
"ok": 1,
"$clusterTime": {
"clusterTime": "6870210161760272385",
"signature": {
"hash": "nF2DFB6slcL/6QI/GSWOFC5i02I=",
"keyId": "6808260988001845250"
}
},
"operationTime": "6870210161760272385"
},
"connection": {
"_events": {},
"_eventsCount": 4,
"id": 1,
"address": "40.79.242.150:27017",
"bson": {},
"socketTimeout": 360000,
"monitorCommands": false,
"closed": false,
"destroyed": false,
"lastIsMasterMS": 209
},
"modifiedCount": 1,
"upsertedId": null,
"upsertedCount": 0,
"matchedCount": 1,
"n": 1,
"nModified": 1,
"opTime": {
"ts": "6870210161760272385",
"t": 23
},
"electionId": "7fffffff0000000000000017",
"ok": 1,
"$clusterTime": {
"clusterTime": "6870210161760272385",
"signature": {
"hash": "nF2DFB6slcL/6QI/GSWOFC5i02I=",
"keyId": "6808260988001845250"
}
},
"operationTime": "6870210161760272385"
}
]
Run Code Online (Sandbox Code Playgroud)
这对我来说根本没有意义。除了以下几个属性:
"modifiedCount": 0,
"upsertedId": null,
"upsertedCount": 0,
"matchedCount": 1,
Run Code Online (Sandbox Code Playgroud)
我能否获取响应中因“updateMany()”而受到影响的所有 ObjectId 甚至整个文档的数组?
我知道类似的事情是可能的,findOneAndUpdate()但问题是它只更新一条记录。我不想循环它。这对性能来说是不利的。
| 归档时间: |
|
| 查看次数: |
3887 次 |
| 最近记录: |