BulkWriteResult
in package
Result class for a bulk write operation.
Table of Contents
Properties
- $insertedIds : array<string|int, mixed>
- $writeResult : WriteResult
Methods
- __construct() : mixed
- getDeletedCount() : int
- Return the number of documents that were deleted.
- getInsertedCount() : int
- Return the number of documents that were inserted.
- getInsertedIds() : array<string|int, mixed>
- Return a map of the inserted documents' IDs.
- 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.
- getUpsertedIds() : array<string|int, mixed>
- Return a map of the upserted documents' IDs.
- isAcknowledged() : bool
- Return whether this update was acknowledged by the server.
Properties
$insertedIds
private
array<string|int, mixed>
$insertedIds
$writeResult
private
WriteResult
$writeResult
Methods
__construct()
public
__construct(WriteResult $writeResult, array<string|int, mixed> $insertedIds) : mixed
Parameters
- $writeResult : WriteResult
- $insertedIds : array<string|int, mixed>
getDeletedCount()
Return the number of documents that were deleted.
public
getDeletedCount() : int
This method should only be called if the write was acknowledged.
Tags
Return values
intgetInsertedCount()
Return the number of documents that were inserted.
public
getInsertedCount() : int
This method should only be called if the write was acknowledged.
Tags
Return values
intgetInsertedIds()
Return a map of the inserted documents' IDs.
public
getInsertedIds() : array<string|int, mixed>
The index of each ID in the map corresponds to each document's position in the bulk operation. If a document had an ID prior to inserting (i.e. the driver did not generate an ID), the index will contain its "_id" field value. Any driver-generated ID will be a MongoDB\BSON\ObjectId instance.
Return values
array<string|int, 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
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
intgetUpsertedIds()
Return a map of the upserted documents' IDs.
public
getUpsertedIds() : array<string|int, mixed>
The index of each ID in the map corresponds to each document's position in bulk operation. If a 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 method should only be called if the write was acknowledged.
Tags
Return values
array<string|int, mixed>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.