My output in PHP from a var_dump() shows the result of a updateOne MongoDB command to a collection:
object(MongoDB\UpdateResult)#136 (2) {
["writeResult":"MongoDB\UpdateResult":private] => object(MongoDB\Driver\WriteResult)#135 (9) {
["nInserted"]=> int(0)
["nMatched"]=> int(0)
["nModified"]=> int(0)
"nRemoved"]=> int(0)
["nUpserted"]=> int(0)
["upsertedIds"]=> array(0) { }
["writeErrors"]=> array(0) { }
["writeConcernError"]=> NULL
["writeConcern"]=> array(4) {
["w"]=> NULL
["wmajority"]=> bool(false)
["wtimeout"]=> int(0)
["journal"]=> NULL
}
}
["isAcknowledged":"MongoDB\UpdateResult":private]=> bool(true)
}
My question is, how do I convert this into PHP and access the value for "nMatched" and "nInserted"?
getMatchedCountto get thenMatchedvalue, however there does not seem to be an equivalent one fornInserted, which probably makes sense since this is anUpdateResultand would only have modified values.