InsertOneResult
in package
Result class for a single-document insert operation.
Table of Contents
- $insertedId : mixed
- $isAcknowledged : bool
- $writeResult : WriteResult
- __construct() : mixed
- getInsertedCount() : int
- Return the number of documents that were inserted.
- getInsertedId() : mixed
- Return the inserted document's ID.
- isAcknowledged() : bool
- Return whether this insert was acknowledged by the server.
Properties
$insertedId
private
mixed
$insertedId
$isAcknowledged
private
bool
$isAcknowledged
$writeResult
private
WriteResult
$writeResult
Methods
__construct()
public
__construct(WriteResult $writeResult, mixed $insertedId) : mixed
Parameters
- $writeResult : WriteResult
- $insertedId : 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 —getInsertedId()
Return the inserted document's ID.
public
getInsertedId() : mixed
If the document had an ID prior to inserting (i.e. the driver did not need to generate an ID), this will contain its "_id". Any driver-generated ID will be a MongoDB\BSON\ObjectId instance.
Return values
mixed —isAcknowledged()
Return whether this insert 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.
If the insert was not acknowledged, other fields from the WriteResult (e.g. insertedCount) will be undefined and their getter methods should not be invoked.