UpdateResult
in package
Result class for an update operation.
Table of Contents
- $isAcknowledged : bool
- $writeResult : WriteResult
- __construct() : mixed
- getMatchedCount() : int
- Return the number of documents that were matched by the filter.
- getModifiedCount() : int|null
- Return the number of documents that were modified.
- getUpsertedCount() : int
- Return the number of documents that were upserted.
- getUpsertedId() : mixed|null
- Return the ID of the document inserted by an upsert operation.
- isAcknowledged() : bool
- Return whether this update was acknowledged by the server.
Properties
$isAcknowledged
private
bool
$isAcknowledged
$writeResult
private
WriteResult
$writeResult
Methods
__construct()
public
__construct(WriteResult $writeResult) : mixed
Parameters
- $writeResult : WriteResult
Return values
mixed —getMatchedCount()
Return the number of documents that were matched by the filter.
public
getMatchedCount() : int
This method should only be called if the write was acknowledged.
Tags
Return values
int —getModifiedCount()
Return the number of documents that were modified.
public
getModifiedCount() : int|null
This value is undefined (i.e. null) if the write executed as a legacy operation instead of command.
This method should only be called if the write was acknowledged.
Tags
Return values
int|null —getUpsertedCount()
Return the number of documents that were upserted.
public
getUpsertedCount() : int
This method should only be called if the write was acknowledged.
Tags
Return values
int —getUpsertedId()
Return the ID of the document inserted by an upsert operation.
public
getUpsertedId() : mixed|null
If the document had an ID prior to upserting (i.e. the server did not need to generate an ID), this will contain its "_id". Any server-generated ID will be a MongoDB\BSON\ObjectId instance.
This value is undefined (i.e. null) if an upsert did not take place.
This method should only be called if the write was acknowledged.
Tags
Return values
mixed|null —isAcknowledged()
Return whether this update was acknowledged by the server.
public
isAcknowledged() : bool
If the update was not acknowledged, other fields from the WriteResult (e.g. matchedCount) will be undefined and their getter methods should not be invoked.