Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongo-php-library
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sinan
mongo-php-library
Commits
3495dc9e
Commit
3495dc9e
authored
Nov 16, 2016
by
Jeremy Mikola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PHPLIB-235: Document write result classes
parent
7dc53b8e
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
1033 additions
and
13 deletions
+1033
-13
extracts-error.yaml
docs/includes/extracts-error.yaml
+6
-0
reference.txt
docs/reference.txt
+1
-0
MongoDBBulkWriteResult-getDeletedCount.txt
...ference/method/MongoDBBulkWriteResult-getDeletedCount.txt
+42
-0
MongoDBBulkWriteResult-getInsertedCount.txt
...erence/method/MongoDBBulkWriteResult-getInsertedCount.txt
+42
-0
MongoDBBulkWriteResult-getInsertedIds.txt
...eference/method/MongoDBBulkWriteResult-getInsertedIds.txt
+38
-0
MongoDBBulkWriteResult-getMatchedCount.txt
...ference/method/MongoDBBulkWriteResult-getMatchedCount.txt
+51
-0
MongoDBBulkWriteResult-getModifiedCount.txt
...erence/method/MongoDBBulkWriteResult-getModifiedCount.txt
+54
-0
MongoDBBulkWriteResult-getUpsertedCount.txt
...erence/method/MongoDBBulkWriteResult-getUpsertedCount.txt
+42
-0
MongoDBBulkWriteResult-getUpsertedIds.txt
...eference/method/MongoDBBulkWriteResult-getUpsertedIds.txt
+46
-0
MongoDBBulkWriteResult-isAcknowledged.txt
...eference/method/MongoDBBulkWriteResult-isAcknowledged.txt
+34
-0
MongoDBDeleteResult-getDeletedCount.txt
.../reference/method/MongoDBDeleteResult-getDeletedCount.txt
+40
-0
MongoDBDeleteResult-isAcknowledged.txt
docs/reference/method/MongoDBDeleteResult-isAcknowledged.txt
+34
-0
MongoDBInsertManyResult-getInsertedCount.txt
...rence/method/MongoDBInsertManyResult-getInsertedCount.txt
+40
-0
MongoDBInsertManyResult-getInsertedIds.txt
...ference/method/MongoDBInsertManyResult-getInsertedIds.txt
+36
-0
MongoDBInsertManyResult-isAcknowledged.txt
...ference/method/MongoDBInsertManyResult-isAcknowledged.txt
+34
-0
MongoDBInsertOneResult-getInsertedCount.txt
...erence/method/MongoDBInsertOneResult-getInsertedCount.txt
+41
-0
MongoDBInsertOneResult-getInsertedId.txt
...reference/method/MongoDBInsertOneResult-getInsertedId.txt
+35
-0
MongoDBInsertOneResult-isAcknowledged.txt
...eference/method/MongoDBInsertOneResult-isAcknowledged.txt
+34
-0
MongoDBUpdateResult-getMatchedCount.txt
.../reference/method/MongoDBUpdateResult-getMatchedCount.txt
+49
-0
MongoDBUpdateResult-getModifiedCount.txt
...reference/method/MongoDBUpdateResult-getModifiedCount.txt
+52
-0
MongoDBUpdateResult-getUpsertedCount.txt
...reference/method/MongoDBUpdateResult-getUpsertedCount.txt
+42
-0
MongoDBUpdateResult-getUpsertedId.txt
docs/reference/method/MongoDBUpdateResult-getUpsertedId.txt
+44
-0
MongoDBUpdateResult-isAcknowledged.txt
docs/reference/method/MongoDBUpdateResult-isAcknowledged.txt
+34
-0
write-result-classes.txt
docs/reference/write-result-classes.txt
+143
-0
BulkWriteResult.php
src/BulkWriteResult.php
+8
-7
InsertManyResult.php
src/InsertManyResult.php
+5
-4
InsertOneResult.php
src/InsertOneResult.php
+2
-2
UpdateResult.php
src/UpdateResult.php
+4
-0
No files found.
docs/includes/extracts-error.yaml
View file @
3495dc9e
...
@@ -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
...
...
docs/reference.txt
View file @
3495dc9e
...
@@ -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
docs/reference/method/MongoDBBulkWriteResult-getDeletedCount.txt
0 → 100644
View file @
3495dc9e
===========================================
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>`
docs/reference/method/MongoDBBulkWriteResult-getInsertedCount.txt
0 → 100644
View file @
3495dc9e
============================================
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>`
docs/reference/method/MongoDBBulkWriteResult-getInsertedIds.txt
0 → 100644
View file @
3495dc9e
==========================================
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.
docs/reference/method/MongoDBBulkWriteResult-getMatchedCount.txt
0 → 100644
View file @
3495dc9e
===========================================
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>`
docs/reference/method/MongoDBBulkWriteResult-getModifiedCount.txt
0 → 100644
View file @
3495dc9e
============================================
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>`
docs/reference/method/MongoDBBulkWriteResult-getUpsertedCount.txt
0 → 100644
View file @
3495dc9e
============================================
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>`
docs/reference/method/MongoDBBulkWriteResult-getUpsertedIds.txt
0 → 100644
View file @
3495dc9e
==========================================
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>`
docs/reference/method/MongoDBBulkWriteResult-isAcknowledged.txt
0 → 100644
View file @
3495dc9e
==========================================
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
docs/reference/method/MongoDBDeleteResult-getDeletedCount.txt
0 → 100644
View file @
3495dc9e
========================================
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>`
docs/reference/method/MongoDBDeleteResult-isAcknowledged.txt
0 → 100644
View file @
3495dc9e
=======================================
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
docs/reference/method/MongoDBInsertManyResult-getInsertedCount.txt
0 → 100644
View file @
3495dc9e
=============================================
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>`
docs/reference/method/MongoDBInsertManyResult-getInsertedIds.txt
0 → 100644
View file @
3495dc9e
===========================================
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.
docs/reference/method/MongoDBInsertManyResult-isAcknowledged.txt
0 → 100644
View file @
3495dc9e
===========================================
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
docs/reference/method/MongoDBInsertOneResult-getInsertedCount.txt
0 → 100644
View file @
3495dc9e
============================================
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>`
docs/reference/method/MongoDBInsertOneResult-getInsertedId.txt
0 → 100644
View file @
3495dc9e
=========================================
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.
docs/reference/method/MongoDBInsertOneResult-isAcknowledged.txt
0 → 100644
View file @
3495dc9e
==========================================
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
docs/reference/method/MongoDBUpdateResult-getMatchedCount.txt
0 → 100644
View file @
3495dc9e
========================================
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>`
docs/reference/method/MongoDBUpdateResult-getModifiedCount.txt
0 → 100644
View file @
3495dc9e
=========================================
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>`
docs/reference/method/MongoDBUpdateResult-getUpsertedCount.txt
0 → 100644
View file @
3495dc9e
=========================================
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>`
docs/reference/method/MongoDBUpdateResult-getUpsertedId.txt
0 → 100644
View file @
3495dc9e
======================================
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>`
docs/reference/method/MongoDBUpdateResult-isAcknowledged.txt
0 → 100644
View file @
3495dc9e
=======================================
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
docs/reference/write-result-classes.txt
0 → 100644
View file @
3495dc9e
====================
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
src/BulkWriteResult.php
View file @
3495dc9e
...
@@ -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 a
n
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.
*
*
...
...
src/InsertManyResult.php
View file @
3495dc9e
...
@@ -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[]
*/
*/
...
...
src/InsertOneResult.php
View file @
3495dc9e
...
@@ -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 a
n
MongoDB\BSON\ObjectID instance.
* driver-generated ID will be a MongoDB\BSON\ObjectID instance.
*
*
* @return mixed
* @return mixed
*/
*/
...
...
src/UpdateResult.php
View file @
3495dc9e
...
@@ -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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment