Commit 3495dc9e authored by Jeremy Mikola's avatar Jeremy Mikola

PHPLIB-235: Document write result classes

parent 7dc53b8e
...@@ -10,6 +10,12 @@ content: | ...@@ -10,6 +10,12 @@ content: |
<mongodb-driver-exception-runtimeexception>` for other errors at the driver <mongodb-driver-exception-runtimeexception>` for other errors at the driver
level (e.g. connection errors). level (e.g. connection errors).
--- ---
ref: error-badmethodcallexception-write-result
content: |
:phpclass:`MongoDB\\Exception\\BadMethodCallException` if this method is
called and the write operation used an unacknowledged :manual:`write concern
</reference/write-concern>`.
---
ref: error-invalidargumentexception ref: error-invalidargumentexception
content: | content: |
:phpclass:`MongoDB\\Exception\\InvalidArgumentException` for errors related to :phpclass:`MongoDB\\Exception\\InvalidArgumentException` for errors related to
......
...@@ -12,4 +12,5 @@ Reference ...@@ -12,4 +12,5 @@ Reference
/reference/class/MongoDBDatabase /reference/class/MongoDBDatabase
/reference/class/MongoDBCollection /reference/class/MongoDBCollection
/reference/class/MongoDBGridFSBucket /reference/class/MongoDBGridFSBucket
/reference/write-result-classes
/reference/exception-classes /reference/exception-classes
===========================================
MongoDB\\BulkWriteResult::getDeletedCount()
===========================================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. phpmethod:: MongoDB\\BulkWriteResult::getDeletedCount()
Return the total number of documents that were deleted by all delete
operations in the bulk write.
.. code-block:: php
function getDeletedCount(): integer
This method should only be called if the write was acknowledged.
Return Values
-------------
The total number of documents that were deleted by all delete operations in the
bulk write.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-badmethodcallexception-write-result.rst
See Also
--------
- :php:`MongoDB\\Driver\\WriteResult::getDeletedCount()
<manual/en/mongodb-driver-writeresult.getdeletedcount.php>`
============================================
MongoDB\\BulkWriteResult::getInsertedCount()
============================================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. phpmethod:: MongoDB\\BulkWriteResult::getInsertedCount()
Return the total number of documents that were inserted by all insert
operations in the bulk write.
.. code-block:: php
function getInsertedCount(): integer
This method should only be called if the write was acknowledged.
Return Values
-------------
The total number of documents that were inserted by all insert operations in the
bulk write.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-badmethodcallexception-write-result.rst
See Also
--------
- :php:`MongoDB\\Driver\\WriteResult::getInsertedCount()
<manual/en/mongodb-driver-writeresult.getinsertedcount.php>`
==========================================
MongoDB\\BulkWriteResult::getInsertedIds()
==========================================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. phpmethod:: MongoDB\\BulkWriteResult::getInsertedIds()
Return a map of IDs (i.e. ``_id`` field values) for documents that were
inserted by all insert operations in the bulk write.
.. code-block:: php
function getInsertedIds(): array
Since IDs are created by the driver, this method may be called irrespective
of whether the write was acknowledged.
Return Values
-------------
A map of IDs (i.e. ``_id`` field values) for documents that were inserted by all
insert operations in the bulk write.
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 :php:`MongoDB\\BSON\\ObjectID
<class.mongodb-bson-objectid>` instance.
===========================================
MongoDB\\BulkWriteResult::getMatchedCount()
===========================================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. phpmethod:: MongoDB\\BulkWriteResult::getMatchedCount()
Return the total number of documents that were matched by all update and
replace operations in the bulk write.
.. code-block:: php
function getMatchedCount(): integer
This method should only be called if the write was acknowledged.
.. note::
If an update/replace operation results in no change to the document
(e.g. setting the value of a field to its current value), the matched
count may be greater than the value returned by
:phpmethod:`getModifiedCount()
<MongoDB\\BulkWriteResult::getModifiedCount()>`.
Return Values
-------------
The total number of documents that were matched by all update and replace
operations in the bulk write.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-badmethodcallexception-write-result.rst
See Also
--------
- :phpmethod:`MongoDB\\BulkWriteResult::getModifiedCount()`
- :php:`MongoDB\\Driver\\WriteResult::getMatchedCount()
<manual/en/mongodb-driver-writeresult.getmatchedcount.php>`
============================================
MongoDB\\BulkWriteResult::getModifiedCount()
============================================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. phpmethod:: MongoDB\\BulkWriteResult::getModifiedCount()
Return the total number of documents that were modified by all update and
replace operations in the bulk write.
.. code-block:: php
function getModifiedCount(): integer|null
This method should only be called if the write was acknowledged.
.. note::
If an update/replace operation results in no change to the document
(e.g. setting the value of a field to its current value), the modified
count may be less than the value returned by :phpmethod:`getMatchedCount()
<MongoDB\\BulkWriteResult::getMatchedCount()>`.
Return Values
-------------
The total number of documents that were modified by all update and replace
operations in the bulk write.
The modified count is not available on versions of MongoDB before 2.6, which
used the legacy wire protocol version (i.e. ``OP_UPDATE``). If this is the case,
the modified count will be ``null``.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-badmethodcallexception-write-result.rst
See Also
--------
- :phpmethod:`MongoDB\\BulkWriteResult::getMatchedCount()`
- :php:`MongoDB\\Driver\\WriteResult::getModifiedCount()
<manual/en/mongodb-driver-writeresult.getmodifiedcount.php>`
============================================
MongoDB\\BulkWriteResult::getUpsertedCount()
============================================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. phpmethod:: MongoDB\\BulkWriteResult::getUpsertedCount()
Return the total number of documents that were upserted by all update and
replace operations in the bulk write.
.. code-block:: php
function getUpsertedCount(): integer
This method should only be called if the write was acknowledged.
Return Values
-------------
The total number of documents that were upserted by all update and replace
operations in the bulk write.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-badmethodcallexception-write-result.rst
See Also
--------
- :php:`MongoDB\\Driver\\WriteResult::getUpsertedCount()
<manual/en/mongodb-driver-writeresult.getupsertedcount.php>`
==========================================
MongoDB\\BulkWriteResult::getUpsertedIds()
==========================================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. phpmethod:: MongoDB\\BulkWriteResult::getUpsertedIds()
Return a map of IDs (i.e. ``_id`` field values) for documents that were
upserted by all update and replace operations in the bulk write.
.. code-block:: php
function getUpsertedIds(): array
Return Values
-------------
A map of IDs (i.e. ``_id`` field values) for documents that were upserted by all
update and replace operations in the bulk write.
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 upserting (i.e. the server did
not generate an ID), the index will contain its ``_id`` field value. Any
server-generated ID will be a :php:`MongoDB\\BSON\\ObjectID
<class.mongodb-bson-objectid>` instance.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-badmethodcallexception-write-result.rst
See Also
--------
- :php:`MongoDB\\Driver\\WriteResult::getUpsertedIds()
<manual/en/mongodb-driver-writeresult.getupsertedids.php>`
==========================================
MongoDB\\BulkWriteResult::isAcknowledged()
==========================================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. phpmethod:: MongoDB\\BulkWriteResult::isAcknowledged()
Return whether the write was acknowledged.
.. code-block:: php
function isAcknowledged(): boolean
Return Values
-------------
A boolean indicating whether the write was acknowledged.
See Also
--------
- :php:`MongoDB\\Driver\\WriteResult::isAcknowledged()
<manual/en/mongodb-driver-writeresult.isacknowledged.php>`
- :manual:`Write Concern </reference/write-concern>` in the MongoDB manual
========================================
MongoDB\\DeleteResult::getDeletedCount()
========================================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. phpmethod:: MongoDB\\DeleteResult::getDeletedCount()
Return the number of documents that were deleted.
.. code-block:: php
function getDeletedCount(): integer
This method should only be called if the write was acknowledged.
Return Values
-------------
The number of documents that were deleted.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-badmethodcallexception-write-result.rst
See Also
--------
- :php:`MongoDB\\Driver\\WriteResult::getDeletedCount()
<manual/en/mongodb-driver-writeresult.getdeletedcount.php>`
=======================================
MongoDB\\DeleteResult::isAcknowledged()
=======================================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. phpmethod:: MongoDB\\DeleteResult::isAcknowledged()
Return whether the write was acknowledged.
.. code-block:: php
function isAcknowledged(): boolean
Return Values
-------------
A boolean indicating whether the write was acknowledged.
See Also
--------
- :php:`MongoDB\\Driver\\WriteResult::isAcknowledged()
<manual/en/mongodb-driver-writeresult.isacknowledged.php>`
- :manual:`Write Concern </reference/write-concern>` in the MongoDB manual
=============================================
MongoDB\\InsertManyResult::getInsertedCount()
=============================================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. phpmethod:: MongoDB\\InsertManyResult::getInsertedCount()
Return the number of documents that were inserted.
.. code-block:: php
function getInsertedCount(): integer
This method should only be called if the write was acknowledged.
Return Values
-------------
The number of documents that were inserted.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-badmethodcallexception-write-result.rst
See Also
--------
- :php:`MongoDB\\Driver\\WriteResult::getInsertedCount()
<manual/en/mongodb-driver-writeresult.getinsertedcount.php>`
===========================================
MongoDB\\InsertManyResult::getInsertedIds()
===========================================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. phpmethod:: MongoDB\\InsertManyResult::getInsertedIds()
Return a map of IDs (i.e. ``_id`` field values) for the inserted documents.
.. code-block:: php
function getInsertedIds(): array
Since IDs are created by the driver, this method may be called irrespective
of whether the write was acknowledged.
Return Values
-------------
A map of IDs (i.e. ``_id`` field values) for the inserted documents.
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 :php:`MongoDB\\BSON\\ObjectID
<class.mongodb-bson-objectid>` instance.
===========================================
MongoDB\\InsertManyResult::isAcknowledged()
===========================================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. phpmethod:: MongoDB\\InsertManyResult::isAcknowledged()
Return whether the write was acknowledged.
.. code-block:: php
function isAcknowledged(): boolean
Return Values
-------------
A boolean indicating whether the write was acknowledged.
See Also
--------
- :php:`MongoDB\\Driver\\WriteResult::isAcknowledged()
<manual/en/mongodb-driver-writeresult.isacknowledged.php>`
- :manual:`Write Concern </reference/write-concern>` in the MongoDB manual
============================================
MongoDB\\InsertOneResult::getInsertedCount()
============================================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. phpmethod:: MongoDB\\InsertOneResult::getInsertedCount()
Return the number of documents that were inserted.
.. code-block:: php
function getInsertedCount(): integer
This method should only be called if the write was acknowledged.
Return Values
-------------
The number of documents that were inserted. This should be ``1`` for an
acknowledged insert operation.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-badmethodcallexception-write-result.rst
See Also
--------
- :php:`MongoDB\\Driver\\WriteResult::getInsertedCount()
<manual/en/mongodb-driver-writeresult.getinsertedcount.php>`
=========================================
MongoDB\\InsertOneResult::getInsertedId()
=========================================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. phpmethod:: MongoDB\\InsertOneResult::getInsertedId()
Return the ID (i.e. ``_id`` field value) for the inserted document.
.. code-block:: php
function getInsertedId(): mixed
Since IDs are created by the driver, this method may be called irrespective
of whether the write was acknowledged.
Return Values
-------------
The ID (i.e. ``_id`` field value) of the inserted document.
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`` field value. Any driver-generated
ID will be a :php:`MongoDB\\BSON\\ObjectID <class.mongodb-bson-objectid>`
instance.
==========================================
MongoDB\\InsertOneResult::isAcknowledged()
==========================================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. phpmethod:: MongoDB\\InsertOneResult::isAcknowledged()
Return whether the write was acknowledged.
.. code-block:: php
function isAcknowledged(): boolean
Return Values
-------------
A boolean indicating whether the write was acknowledged.
See Also
--------
- :php:`MongoDB\\Driver\\WriteResult::isAcknowledged()
<manual/en/mongodb-driver-writeresult.isacknowledged.php>`
- :manual:`Write Concern </reference/write-concern>` in the MongoDB manual
========================================
MongoDB\\UpdateResult::getMatchedCount()
========================================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. phpmethod:: MongoDB\\UpdateResult::getMatchedCount()
Return the number of documents that were matched.
.. code-block:: php
function getMatchedCount(): integer
This method should only be called if the write was acknowledged.
.. note::
If an update/replace operation results in no change to the document
(e.g. setting the value of a field to its current value), the matched
count may be greater than the value returned by
:phpmethod:`getModifiedCount()
<MongoDB\\UpdateResult::getModifiedCount()>`.
Return Values
-------------
The number of documents that were matched.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-badmethodcallexception-write-result.rst
See Also
--------
- :phpmethod:`MongoDB\\UpdateResult::getModifiedCount()`
- :php:`MongoDB\\Driver\\WriteResult::getMatchedCount()
<manual/en/mongodb-driver-writeresult.getmatchedcount.php>`
=========================================
MongoDB\\UpdateResult::getModifiedCount()
=========================================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. phpmethod:: MongoDB\\UpdateResult::getModifiedCount()
Return the number of documents that were modified.
.. code-block:: php
function getModifiedCount(): integer|null
This method should only be called if the write was acknowledged.
.. note::
If an update/replace operation results in no change to the document
(e.g. setting the value of a field to its current value), the modified
count may be less than the value returned by :phpmethod:`getMatchedCount()
<MongoDB\\UpdateResult::getMatchedCount()>`.
Return Values
-------------
The number of documents that were modified.
The modified count is not available on versions of MongoDB before 2.6, which
used the legacy wire protocol version (i.e. ``OP_UPDATE``). If this is the case,
the modified count will be ``null``.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-badmethodcallexception-write-result.rst
See Also
--------
- :phpmethod:`MongoDB\\UpdateResult::getMatchedCount()`
- :php:`MongoDB\\Driver\\WriteResult::getModifiedCount()
<manual/en/mongodb-driver-writeresult.getmodifiedcount.php>`
=========================================
MongoDB\\UpdateResult::getUpsertedCount()
=========================================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. phpmethod:: MongoDB\\UpdateResult::getUpsertedCount()
Return the number of documents that were upserted.
.. code-block:: php
function getUpsertedCount(): integer
This method should only be called if the write was acknowledged.
Return Values
-------------
The total number of documents that were upserted. This should be either ``0`` or
``1`` for an acknowledged update or replace operation, depending on whether an
upsert occurred.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-badmethodcallexception-write-result.rst
See Also
--------
- :php:`MongoDB\\Driver\\WriteResult::getUpsertedCount()
<manual/en/mongodb-driver-writeresult.getupsertedcount.php>`
======================================
MongoDB\\UpdateResult::getUpsertedId()
======================================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. phpmethod:: MongoDB\\UpdateResult::getUpsertedId()
Return the ID (i.e. ``_id`` field value) of the upserted document.
.. code-block:: php
function getUpsertedId(): mixed|null
Return Values
-------------
The ID (i.e. ``_id`` field value) of the upserted document. If no document was
upserted, ``null`` will be returned.
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`` field value. Any server-generated
ID will be a :php:`MongoDB\\BSON\\ObjectID <class.mongodb-bson-objectid>`
instance.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-badmethodcallexception-write-result.rst
See Also
--------
- :php:`MongoDB\\Driver\\WriteResult::getUpsertedIds()
<manual/en/mongodb-driver-writeresult.getupsertedids.php>`
=======================================
MongoDB\\UpdateResult::isAcknowledged()
=======================================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
Definition
----------
.. phpmethod:: MongoDB\\UpdateResult::isAcknowledged()
Return whether the write was acknowledged.
.. code-block:: php
function isAcknowledged(): boolean
Return Values
-------------
A boolean indicating whether the write was acknowledged.
See Also
--------
- :php:`MongoDB\\Driver\\WriteResult::isAcknowledged()
<manual/en/mongodb-driver-writeresult.isacknowledged.php>`
- :manual:`Write Concern </reference/write-concern>` in the MongoDB manual
====================
Write Result Classes
====================
.. default-domain:: mongodb
.. contents:: On this page
:local:
:backlinks: none
:depth: 1
:class: singlecol
MongoDB\\BulkWriteResult
------------------------
Definition
~~~~~~~~~~
.. phpclass:: MongoDB\\BulkWriteResult
This class contains information about an executed bulk write operation. It
encapsulates a :php:`MongoDB\\Driver\\WriteResult
<class.mongodb-driver-writeresult>` object and is returned from
:phpmethod:`MongoDB\\Collection::bulkWrite()`.
Methods
~~~~~~~
.. toctree::
:titlesonly:
/reference/method/MongoDBBulkWriteResult-getDeletedCount
/reference/method/MongoDBBulkWriteResult-getInsertedCount
/reference/method/MongoDBBulkWriteResult-getInsertedIds
/reference/method/MongoDBBulkWriteResult-getMatchedCount
/reference/method/MongoDBBulkWriteResult-getModifiedCount
/reference/method/MongoDBBulkWriteResult-getUpsertedCount
/reference/method/MongoDBBulkWriteResult-getUpsertedIds
/reference/method/MongoDBBulkWriteResult-isAcknowledged
----
MongoDB\\DeleteResult
---------------------
Definition
~~~~~~~~~~
.. phpclass:: MongoDB\\DeleteResult
This class contains information about an executed delete operation. It
encapsulates a :php:`MongoDB\\Driver\\WriteResult
<class.mongodb-driver-writeresult>` object and is returned from
:phpmethod:`MongoDB\\Collection::deleteMany()` or
:phpmethod:`MongoDB\\Collection::deleteOne()`.
Methods
~~~~~~~
.. toctree::
:titlesonly:
/reference/method/MongoDBDeleteResult-getDeletedCount
/reference/method/MongoDBDeleteResult-isAcknowledged
----
MongoDB\\InsertManyResult
-------------------------
Definition
~~~~~~~~~~
.. phpclass:: MongoDB\\InsertManyResult
This class contains information about an executed bulk insert operation. It
encapsulates a :php:`MongoDB\\Driver\\WriteResult
<class.mongodb-driver-writeresult>` object and is returned from
:phpmethod:`MongoDB\\Collection::insertMany()`.
Methods
~~~~~~~
.. toctree::
:titlesonly:
/reference/method/MongoDBInsertManyResult-getInsertedCount
/reference/method/MongoDBInsertManyResult-getInsertedIds
/reference/method/MongoDBInsertManyResult-isAcknowledged
----
MongoDB\\InsertOneResult
------------------------
Definition
~~~~~~~~~~
.. phpclass:: MongoDB\\InsertOneResult
This class contains information about an executed insert operation. It
encapsulates a :php:`MongoDB\\Driver\\WriteResult
<class.mongodb-driver-writeresult>` object and is returned from
:phpmethod:`MongoDB\\Collection::insertOne()`.
Methods
~~~~~~~
.. toctree::
:titlesonly:
/reference/method/MongoDBInsertOneResult-getInsertedCount
/reference/method/MongoDBInsertOneResult-getInsertedId
/reference/method/MongoDBInsertOneResult-isAcknowledged
----
MongoDB\\UpdateResult
---------------------
Definition
~~~~~~~~~~
.. phpclass:: MongoDB\\UpdateResult
This class contains information about an executed update or replace
operation. It encapsulates a :php:`MongoDB\\Driver\\WriteResult
<class.mongodb-driver-writeresult>` object and is returned from
:phpmethod:`MongoDB\\Collection::replaceOne()`,
:phpmethod:`MongoDB\\Collection::updateMany()`, or
:phpmethod:`MongoDB\\Collection::updateOne()`.
Methods
~~~~~~~
.. toctree::
:titlesonly:
/reference/method/MongoDBUpdateResult-getMatchedCount
/reference/method/MongoDBUpdateResult-getModifiedCount
/reference/method/MongoDBUpdateResult-getUpsertedCount
/reference/method/MongoDBUpdateResult-getUpsertedId
/reference/method/MongoDBUpdateResult-isAcknowledged
...@@ -66,10 +66,11 @@ class BulkWriteResult ...@@ -66,10 +66,11 @@ class BulkWriteResult
/** /**
* Return a map of the inserted documents' IDs. * Return a map of the inserted documents' IDs.
* *
* The index of each ID in the map corresponds to the document's position in * The index of each ID in the map corresponds to each document's position
* the bulk operation. If the document had an ID prior to insertion (i.e. * in the bulk operation. If a document had an ID prior to inserting (i.e.
* the driver did not generate an ID), this will contain its "_id" field * the driver did not generate an ID), the index will contain its "_id"
* value. Any driver-generated ID will be an MongoDB\BSON\ObjectID instance. * field value. Any driver-generated ID will be a MongoDB\BSON\ObjectID
* instance.
* *
* @return mixed[] * @return mixed[]
*/ */
...@@ -138,10 +139,10 @@ class BulkWriteResult ...@@ -138,10 +139,10 @@ class BulkWriteResult
/** /**
* Return a map of the upserted documents' IDs. * Return a map of the upserted documents' IDs.
* *
* The index of each ID in the map corresponds to the document's position * The index of each ID in the map corresponds to each document's position
* in bulk operation. If the document had an ID prior to upserting (i.e. the * 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 did not need to generate an ID), this will contain its "_id". Any
* server-generated ID will be an MongoDB\BSON\ObjectID instance. * server-generated ID will be a MongoDB\BSON\ObjectID instance.
* *
* This method should only be called if the write was acknowledged. * This method should only be called if the write was acknowledged.
* *
......
...@@ -48,10 +48,11 @@ class InsertManyResult ...@@ -48,10 +48,11 @@ class InsertManyResult
/** /**
* Return a map of the inserted documents' IDs. * Return a map of the inserted documents' IDs.
* *
* The index of each ID in the map corresponds to the document's position in * The index of each ID in the map corresponds to each document's position
* the bulk operation. If the document had an ID prior to insertion (i.e. * in the bulk operation. If a document had an ID prior to inserting (i.e.
* the driver did not generate an ID), this will contain its "_id" field * the driver did not generate an ID), the index will contain its "_id"
* value. Any driver-generated ID will be an MongoDB\BSON\ObjectID instance. * field value. Any driver-generated ID will be a MongoDB\BSON\ObjectID
* instance.
* *
* @return mixed[] * @return mixed[]
*/ */
......
...@@ -48,9 +48,9 @@ class InsertOneResult ...@@ -48,9 +48,9 @@ class InsertOneResult
/** /**
* Return the inserted document's ID. * Return the inserted document's ID.
* *
* If the document already an ID prior to insertion (i.e. the driver did not * 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 * need to generate an ID), this will contain its "_id". Any
* driver-generated ID will be an MongoDB\BSON\ObjectID instance. * driver-generated ID will be a MongoDB\BSON\ObjectID instance.
* *
* @return mixed * @return mixed
*/ */
......
...@@ -84,6 +84,10 @@ class UpdateResult ...@@ -84,6 +84,10 @@ class UpdateResult
/** /**
* Return the ID of the document inserted by an upsert operation. * Return the ID of the document inserted by an upsert operation.
* *
* 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 value is undefined (i.e. null) if an upsert did not take place.
* *
* This method should only be called if the write was acknowledged. * This method should only be called if the write was acknowledged.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment