UpdateResult
in package
Result class for an update operation.
Table of Contents
Properties
- $writeResult : WriteResult
Methods
- __construct() : mixed
- getMatchedCount() : int
- Return the number of documents that were matched by the filter.
- getModifiedCount() : int
- Return the number of documents that were modified.
- getUpsertedCount() : int
- Return the number of documents that were upserted.
- getUpsertedId() : mixed
- Return the ID of the document inserted by an upsert operation.
- isAcknowledged() : bool
- Return whether this update was acknowledged by the server.
Properties
$writeResult
private
WriteResult
$writeResult
Methods
__construct()
public
__construct(WriteResult $writeResult) : mixed
Parameters
- $writeResult : WriteResult
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
intgetModifiedCount()
Return the number of documents that were modified.
public
getModifiedCount() : int
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
intgetUpsertedCount()
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
intgetUpsertedId()
Return the ID of the document inserted by an upsert operation.
public
getUpsertedId() : mixed
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
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.