MongoDB\UpdateResult::getMatchedCount()
定义
MongoDB\UpdateResult::getMatchedCount()
返回匹配的文档数。
function getMatchedCount(): integer 此方法只能在写操作被确认的情况下调用。
注意
如果更新/替换操作没有改变文档(例如,将字段的值设置为当前值),则匹配计数可能大于
getModifiedCount()
.
返回值
匹配的文档数量。
错误/异常
MongoDB\Exception\BadMethodCallException
如果此方法被调用且使用了未确认的写关注.