PHP Class Phalcon\Db\Adapter\MongoDB\InsertOneResult

Show file Open project: phalcon/incubator

Public Methods

Method Description
__construct ( MongoDB\Driver\WriteResult $writeResult, mixed $insertedId ) Constructor.
getInsertedCount ( ) : integer Return the number of documents that were inserted.
getInsertedId ( ) : mixed Return the inserted document's ID.
isAcknowledged ( ) : boolean Return whether this insert was acknowledged by the server.

Method Details

__construct() public method

Constructor.
public __construct ( MongoDB\Driver\WriteResult $writeResult, mixed $insertedId )
$writeResult MongoDB\Driver\WriteResult
$insertedId mixed

getInsertedCount() public method

This method should only be called if the write was acknowledged.
See also: InsertOneResult::isAcknowledged()
public getInsertedCount ( ) : integer
return integer

getInsertedId() public method

If the document already an ID prior to insertion (i.e. the driver did not need to generate an ID), this will contain its "_id". Any driver-generated ID will be an MongoDB\BSON\ObjectID instance.
public getInsertedId ( ) : mixed
return mixed

isAcknowledged() public method

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.
public isAcknowledged ( ) : boolean
return boolean