Right now this is what I get as response from updateMany()
Response
[
{
"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"
}
]
This makes no sense to me at all. Except for the following few properties:
"modifiedCount": 0,
"upsertedId": null,
"upsertedCount": 0,
"matchedCount": 1,
Can I get an array of all the ObjectIds or even entire document that have been affected as a result of 'updateMany()' in the response?
I know something similar is possible with findOneAndUpdate() but the catch is that it updates only a single record. I don't want to loop over it. That would be bad for performance.