InsertManyResult
in package
Result class for a multi-document insert operation.
Table of Contents
- $insertedIds : array<string|int, mixed>
- $isAcknowledged : bool
- $writeResult : WriteResult
- __construct() : mixed
- getInsertedCount() : int
- Return the number of documents that were inserted.
- getInsertedIds() : array<string|int, mixed>
- Return a map of the inserted documents' IDs.
- isAcknowledged() : bool
- Return whether this insert result was acknowledged by the server.
Properties
$insertedIds
private
array<string|int, mixed>
$insertedIds
$isAcknowledged
private
bool
$isAcknowledged
$writeResult
private
WriteResult
$writeResult
Methods
__construct()
public
__construct(WriteResult $writeResult, array<string|int, mixed> $insertedIds) : mixed
Parameters
- $writeResult : WriteResult
- $insertedIds : array<string|int, mixed>
Return values
mixed —getInsertedCount()
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
int —getInsertedIds()
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> —isAcknowledged()
Return whether this insert result was acknowledged by the server.
public
isAcknowledged() : bool
If the insert was not acknowledged, other fields from the WriteResult (e.g. insertedCount) will be undefined.