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
4fd37901
Commit
4fd37901
authored
Nov 15, 2016
by
Jeremy Mikola
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PHPLIB-234: Document exceptions for API methods
parent
3cc57327
Show whitespace changes
Inline
Side-by-side
Showing
69 changed files
with
473 additions
and
37 deletions
+473
-37
extracts-error.yaml
docs/includes/extracts-error.yaml
+27
-0
MongoDBClient-dropDatabase.txt
docs/reference/method/MongoDBClient-dropDatabase.txt
+7
-0
MongoDBClient-listDatabases.txt
docs/reference/method/MongoDBClient-listDatabases.txt
+7
-0
MongoDBClient-selectCollection.txt
docs/reference/method/MongoDBClient-selectCollection.txt
+5
-0
MongoDBClient-selectDatabase.txt
docs/reference/method/MongoDBClient-selectDatabase.txt
+5
-0
MongoDBClient__construct.txt
docs/reference/method/MongoDBClient__construct.txt
+7
-0
MongoDBCollection-aggregate.txt
docs/reference/method/MongoDBCollection-aggregate.txt
+8
-0
MongoDBCollection-bulkWrite.txt
docs/reference/method/MongoDBCollection-bulkWrite.txt
+7
-0
MongoDBCollection-count.txt
docs/reference/method/MongoDBCollection-count.txt
+8
-0
MongoDBCollection-createIndex.txt
docs/reference/method/MongoDBCollection-createIndex.txt
+7
-0
MongoDBCollection-createIndexes.txt
docs/reference/method/MongoDBCollection-createIndexes.txt
+7
-0
MongoDBCollection-deleteMany.txt
docs/reference/method/MongoDBCollection-deleteMany.txt
+7
-0
MongoDBCollection-deleteOne.txt
docs/reference/method/MongoDBCollection-deleteOne.txt
+7
-0
MongoDBCollection-distinct.txt
docs/reference/method/MongoDBCollection-distinct.txt
+8
-0
MongoDBCollection-drop.txt
docs/reference/method/MongoDBCollection-drop.txt
+7
-0
MongoDBCollection-dropIndex.txt
docs/reference/method/MongoDBCollection-dropIndex.txt
+7
-0
MongoDBCollection-dropIndexes.txt
docs/reference/method/MongoDBCollection-dropIndexes.txt
+7
-0
MongoDBCollection-find.txt
docs/reference/method/MongoDBCollection-find.txt
+7
-0
MongoDBCollection-findOne.txt
docs/reference/method/MongoDBCollection-findOne.txt
+7
-0
MongoDBCollection-findOneAndDelete.txt
docs/reference/method/MongoDBCollection-findOneAndDelete.txt
+8
-0
MongoDBCollection-findOneAndReplace.txt
.../reference/method/MongoDBCollection-findOneAndReplace.txt
+8
-0
MongoDBCollection-findOneAndUpdate.txt
docs/reference/method/MongoDBCollection-findOneAndUpdate.txt
+8
-0
MongoDBCollection-insertMany.txt
docs/reference/method/MongoDBCollection-insertMany.txt
+6
-0
MongoDBCollection-insertOne.txt
docs/reference/method/MongoDBCollection-insertOne.txt
+6
-0
MongoDBCollection-listIndexes.txt
docs/reference/method/MongoDBCollection-listIndexes.txt
+6
-0
MongoDBCollection-replaceOne.txt
docs/reference/method/MongoDBCollection-replaceOne.txt
+7
-0
MongoDBCollection-updateMany.txt
docs/reference/method/MongoDBCollection-updateMany.txt
+7
-0
MongoDBCollection-updateOne.txt
docs/reference/method/MongoDBCollection-updateOne.txt
+7
-0
MongoDBCollection-withOptions.txt
docs/reference/method/MongoDBCollection-withOptions.txt
+5
-0
MongoDBCollection__construct.txt
docs/reference/method/MongoDBCollection__construct.txt
+5
-0
MongoDBDatabase-command.txt
docs/reference/method/MongoDBDatabase-command.txt
+6
-0
MongoDBDatabase-createCollection.txt
docs/reference/method/MongoDBDatabase-createCollection.txt
+7
-0
MongoDBDatabase-drop.txt
docs/reference/method/MongoDBDatabase-drop.txt
+7
-0
MongoDBDatabase-dropCollection.txt
docs/reference/method/MongoDBDatabase-dropCollection.txt
+7
-0
MongoDBDatabase-selectCollection.txt
docs/reference/method/MongoDBDatabase-selectCollection.txt
+5
-0
MongoDBDatabase-selectGridFSBucket.txt
docs/reference/method/MongoDBDatabase-selectGridFSBucket.txt
+5
-0
MongoDBDatabase-withOptions.txt
docs/reference/method/MongoDBDatabase-withOptions.txt
+5
-0
MongoDBDatabase__construct.txt
docs/reference/method/MongoDBDatabase__construct.txt
+5
-0
Client.php
src/Client.php
+15
-1
Collection.php
src/Collection.php
+74
-3
Database.php
src/Database.php
+19
-2
Aggregate.php
src/Operation/Aggregate.php
+3
-1
BulkWrite.php
src/Operation/BulkWrite.php
+3
-1
Count.php
src/Operation/Count.php
+3
-1
CreateCollection.php
src/Operation/CreateCollection.php
+3
-1
CreateIndexes.php
src/Operation/CreateIndexes.php
+5
-1
DatabaseCommand.php
src/Operation/DatabaseCommand.php
+2
-1
Delete.php
src/Operation/Delete.php
+3
-1
DeleteMany.php
src/Operation/DeleteMany.php
+3
-1
DeleteOne.php
src/Operation/DeleteOne.php
+3
-1
Distinct.php
src/Operation/Distinct.php
+3
-1
DropCollection.php
src/Operation/DropCollection.php
+4
-2
DropDatabase.php
src/Operation/DropDatabase.php
+3
-0
DropIndexes.php
src/Operation/DropIndexes.php
+3
-1
Find.php
src/Operation/Find.php
+3
-1
FindAndModify.php
src/Operation/FindAndModify.php
+3
-1
FindOne.php
src/Operation/FindOne.php
+3
-1
FindOneAndDelete.php
src/Operation/FindOneAndDelete.php
+3
-1
FindOneAndReplace.php
src/Operation/FindOneAndReplace.php
+3
-1
FindOneAndUpdate.php
src/Operation/FindOneAndUpdate.php
+3
-1
InsertMany.php
src/Operation/InsertMany.php
+3
-1
InsertOne.php
src/Operation/InsertOne.php
+3
-1
ListCollections.php
src/Operation/ListCollections.php
+7
-2
ListDatabases.php
src/Operation/ListDatabases.php
+3
-1
ListIndexes.php
src/Operation/ListIndexes.php
+6
-3
ReplaceOne.php
src/Operation/ReplaceOne.php
+3
-1
Update.php
src/Operation/Update.php
+3
-1
UpdateMany.php
src/Operation/UpdateMany.php
+3
-1
UpdateOne.php
src/Operation/UpdateOne.php
+3
-1
No files found.
docs/includes/extracts-error.yaml
0 → 100644
View file @
4fd37901
ref
:
error-driver-invalidargumentexception
content
:
|
:php:`MongoDB\\Driver\\Exception\\InvalidArgumentException
<mongodb-driver-exception-invalidargumentexception>` for errors related to the
parsing of parameters or options at the driver level.
---
ref
:
error-driver-runtimeexception
content
:
|
:php:`MongoDB\\Driver\\Exception\\RuntimeException
<mongodb-driver-exception-runtimeexception>` for other errors at the driver
level (e.g. connection errors).
---
ref
:
error-invalidargumentexception
content
:
|
:phpclass:`MongoDB\\Exception\\InvalidArgumentException` for errors related to
the parsing of parameters or options.
---
ref
:
error-unexpectedvalueexception
content
:
|
:phpclass:`MongoDB\\Exception\\UnexpectedValueException` if the command
response from the server was malformed.
---
ref
:
error-unsupportedexception
content
:
|
:phpclass:`MongoDB\\Exception\\UnsupportedException` if options are used and
not supported by the selected server (e.g. ``collation``, ``writeConcern``).
...
docs/reference/method/MongoDBClient-dropDatabase.txt
View file @
4fd37901
...
@@ -36,6 +36,13 @@ An array or object with the result document of the :manual:`dropDatabase
...
@@ -36,6 +36,13 @@ An array or object with the result document of the :manual:`dropDatabase
</reference/command/dropDatabase>` command. The return type will depend on the
</reference/command/dropDatabase>` command. The return type will depend on the
``typeMap`` option.
``typeMap`` option.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unsupportedexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Example
Example
-------
-------
...
...
docs/reference/method/MongoDBClient-listDatabases.txt
View file @
4fd37901
...
@@ -36,6 +36,13 @@ A traversable :phpclass:`MongoDB\\Model\\DatabaseInfoIterator`, which contains
...
@@ -36,6 +36,13 @@ A traversable :phpclass:`MongoDB\\Model\\DatabaseInfoIterator`, which contains
a :phpclass:`MongoDB\\Model\\DatabaseInfo` object for each database on the
a :phpclass:`MongoDB\\Model\\DatabaseInfo` object for each database on the
server.
server.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unexpectedvalueexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Example
Example
-------
-------
...
...
docs/reference/method/MongoDBClient-selectCollection.txt
View file @
4fd37901
...
@@ -34,6 +34,11 @@ Return Values
...
@@ -34,6 +34,11 @@ Return Values
A :phpclass:`MongoDB\\Collection` object.
A :phpclass:`MongoDB\\Collection` object.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-invalidargumentexception.rst
Behavior
Behavior
--------
--------
...
...
docs/reference/method/MongoDBClient-selectDatabase.txt
View file @
4fd37901
...
@@ -34,6 +34,11 @@ Return Values
...
@@ -34,6 +34,11 @@ Return Values
A :phpclass:`MongoDB\\Database` object.
A :phpclass:`MongoDB\\Database` object.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-invalidargumentexception.rst
Behavior
Behavior
--------
--------
...
...
docs/reference/method/MongoDBClient__construct.txt
View file @
4fd37901
...
@@ -29,6 +29,13 @@ Definition
...
@@ -29,6 +29,13 @@ Definition
.. include:: /includes/apiargs/MongoDBClient-method-construct-driverOptions.rst
.. include:: /includes/apiargs/MongoDBClient-method-construct-driverOptions.rst
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Examples
Examples
--------
--------
...
...
docs/reference/method/MongoDBCollection-aggregate.txt
View file @
4fd37901
...
@@ -37,6 +37,14 @@ A :php:`MongoDB\\Driver\\Cursor <class.mongodb-driver-cursor>` or
...
@@ -37,6 +37,14 @@ A :php:`MongoDB\\Driver\\Cursor <class.mongodb-driver-cursor>` or
:php:`ArrayIterator <arrayiterator>` object. In both cases, the return value
:php:`ArrayIterator <arrayiterator>` object. In both cases, the return value
will be :php:`Traversable <traversable>`.
will be :php:`Traversable <traversable>`.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unexpectedvalueexception.rst
.. include:: /includes/extracts/error-unsupportedexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
.. _php-agg-method-behavior:
.. _php-agg-method-behavior:
Behavior
Behavior
...
...
docs/reference/method/MongoDBCollection-bulkWrite.txt
View file @
4fd37901
...
@@ -35,6 +35,13 @@ Return Values
...
@@ -35,6 +35,13 @@ Return Values
A :phpclass:`MongoDB\\BulkWriteResult` object, which encapsulates a
A :phpclass:`MongoDB\\BulkWriteResult` object, which encapsulates a
:php:`MongoDB\\Driver\\WriteResult <class.mongodb-driver-writeresult>` object.
:php:`MongoDB\\Driver\\WriteResult <class.mongodb-driver-writeresult>` object.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unsupportedexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
.. todo: add output and examples
.. todo: add output and examples
See Also
See Also
...
...
docs/reference/method/MongoDBCollection-count.txt
View file @
4fd37901
...
@@ -34,6 +34,14 @@ Return Values
...
@@ -34,6 +34,14 @@ Return Values
The number of documents matching the filter criteria.
The number of documents matching the filter criteria.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unexpectedvalueexception.rst
.. include:: /includes/extracts/error-unsupportedexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
.. todo: add output and examples
.. todo: add output and examples
See Also
See Also
...
...
docs/reference/method/MongoDBCollection-createIndex.txt
View file @
4fd37901
...
@@ -39,6 +39,13 @@ Return Values
...
@@ -39,6 +39,13 @@ Return Values
The name of the created index as a string.
The name of the created index as a string.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unsupportedexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Examples
Examples
--------
--------
...
...
docs/reference/method/MongoDBCollection-createIndexes.txt
View file @
4fd37901
...
@@ -34,6 +34,13 @@ Return Values
...
@@ -34,6 +34,13 @@ Return Values
The names of the created indexes as an array of strings.
The names of the created indexes as an array of strings.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unsupportedexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
``$indexes`` parameter
``$indexes`` parameter
----------------------
----------------------
...
...
docs/reference/method/MongoDBCollection-deleteMany.txt
View file @
4fd37901
...
@@ -35,6 +35,13 @@ Return Values
...
@@ -35,6 +35,13 @@ Return Values
A :phpclass:`MongoDB\\DeleteResult` object, which encapsulates a
A :phpclass:`MongoDB\\DeleteResult` object, which encapsulates a
:php:`MongoDB\\Driver\\WriteResult <class.mongodb-driver-writeresult>` object.
:php:`MongoDB\\Driver\\WriteResult <class.mongodb-driver-writeresult>` object.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unsupportedexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Example
Example
-------
-------
...
...
docs/reference/method/MongoDBCollection-deleteOne.txt
View file @
4fd37901
...
@@ -37,6 +37,13 @@ Return Values
...
@@ -37,6 +37,13 @@ Return Values
A :phpclass:`MongoDB\\DeleteResult` object, which encapsulates a
A :phpclass:`MongoDB\\DeleteResult` object, which encapsulates a
:php:`MongoDB\\Driver\\WriteResult <class.mongodb-driver-writeresult>` object.
:php:`MongoDB\\Driver\\WriteResult <class.mongodb-driver-writeresult>` object.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unsupportedexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Example
Example
-------
-------
...
...
docs/reference/method/MongoDBCollection-distinct.txt
View file @
4fd37901
...
@@ -34,6 +34,14 @@ Return Values
...
@@ -34,6 +34,14 @@ Return Values
An array of the distinct values.
An array of the distinct values.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unexpectedvalueexception.rst
.. include:: /includes/extracts/error-unsupportedexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Examples
Examples
--------
--------
...
...
docs/reference/method/MongoDBCollection-drop.txt
View file @
4fd37901
...
@@ -36,6 +36,13 @@ An array or object with the result document of the :manual:`drop
...
@@ -36,6 +36,13 @@ An array or object with the result document of the :manual:`drop
</reference/command/drop>` command. The return type will depend on the
</reference/command/drop>` command. The return type will depend on the
``typeMap`` option.
``typeMap`` option.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unsupportedexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Example
Example
-------
-------
...
...
docs/reference/method/MongoDBCollection-dropIndex.txt
View file @
4fd37901
...
@@ -36,6 +36,13 @@ An array or object with the result document of the :manual:`dropIndexes
...
@@ -36,6 +36,13 @@ An array or object with the result document of the :manual:`dropIndexes
</reference/command/dropIndexes>` command. The return type will depend on the
</reference/command/dropIndexes>` command. The return type will depend on the
``typeMap`` option.
``typeMap`` option.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unsupportedexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Example
Example
-------
-------
...
...
docs/reference/method/MongoDBCollection-dropIndexes.txt
View file @
4fd37901
...
@@ -37,6 +37,13 @@ An array or object with the result document of the :manual:`dropIndexes
...
@@ -37,6 +37,13 @@ An array or object with the result document of the :manual:`dropIndexes
</reference/command/dropIndexes>` command. The return type will depend on the
</reference/command/dropIndexes>` command. The return type will depend on the
``typeMap`` option.
``typeMap`` option.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unsupportedexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Example
Example
-------
-------
...
...
docs/reference/method/MongoDBCollection-find.txt
View file @
4fd37901
...
@@ -34,6 +34,13 @@ Return Values
...
@@ -34,6 +34,13 @@ Return Values
A :php:`MongoDB\\Driver\\Cursor <class.mongodb-driver-cursor>` object.
A :php:`MongoDB\\Driver\\Cursor <class.mongodb-driver-cursor>` object.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unsupportedexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Examples
Examples
--------
--------
...
...
docs/reference/method/MongoDBCollection-findOne.txt
View file @
4fd37901
...
@@ -36,6 +36,13 @@ An array or object for the :term:`first document <natural order>` document that
...
@@ -36,6 +36,13 @@ An array or object for the :term:`first document <natural order>` document that
matched the query, or ``null`` if no document matched the query. The return type
matched the query, or ``null`` if no document matched the query. The return type
will depend on the ``typeMap`` option.
will depend on the ``typeMap`` option.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unsupportedexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Examples
Examples
--------
--------
...
...
docs/reference/method/MongoDBCollection-findOneAndDelete.txt
View file @
4fd37901
...
@@ -37,6 +37,14 @@ Return Values
...
@@ -37,6 +37,14 @@ Return Values
An object for the document that was deleted, or ``null`` if no document matched
An object for the document that was deleted, or ``null`` if no document matched
the query.
the query.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unexpectedvalueexception.rst
.. include:: /includes/extracts/error-unsupportedexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Examples
Examples
--------
--------
...
...
docs/reference/method/MongoDBCollection-findOneAndReplace.txt
View file @
4fd37901
...
@@ -38,6 +38,14 @@ An object for either the original or the replaced document, depending on the
...
@@ -38,6 +38,14 @@ An object for either the original or the replaced document, depending on the
specified value of the ``returnDocument`` option. By default, the original
specified value of the ``returnDocument`` option. By default, the original
document is returned. If no document matched the query, ``null`` is returned.
document is returned. If no document matched the query, ``null`` is returned.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unexpectedvalueexception.rst
.. include:: /includes/extracts/error-unsupportedexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Examples
Examples
--------
--------
...
...
docs/reference/method/MongoDBCollection-findOneAndUpdate.txt
View file @
4fd37901
...
@@ -38,6 +38,14 @@ An object for either the original or the updated document, depending on the
...
@@ -38,6 +38,14 @@ An object for either the original or the updated document, depending on the
specified value of the ``returnDocument`` option. By default, the original
specified value of the ``returnDocument`` option. By default, the original
document is returned. If no document matched the query, ``null`` is returned.
document is returned. If no document matched the query, ``null`` is returned.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unexpectedvalueexception.rst
.. include:: /includes/extracts/error-unsupportedexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Examples
Examples
--------
--------
...
...
docs/reference/method/MongoDBCollection-insertMany.txt
View file @
4fd37901
...
@@ -35,6 +35,12 @@ Return Values
...
@@ -35,6 +35,12 @@ Return Values
A :phpclass:`MongoDB\\InsertManyResult` object, which encapsulates a
A :phpclass:`MongoDB\\InsertManyResult` object, which encapsulates a
:php:`MongoDB\\Driver\\WriteResult <class.mongodb-driver-writeresult>` object.
:php:`MongoDB\\Driver\\WriteResult <class.mongodb-driver-writeresult>` object.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Example
Example
-------
-------
...
...
docs/reference/method/MongoDBCollection-insertOne.txt
View file @
4fd37901
...
@@ -35,6 +35,12 @@ Return Values
...
@@ -35,6 +35,12 @@ Return Values
A :phpclass:`MongoDB\\InsertOneResult` object, which encapsulates a
A :phpclass:`MongoDB\\InsertOneResult` object, which encapsulates a
:php:`MongoDB\\Driver\\WriteResult <class.mongodb-driver-writeresult>` object.
:php:`MongoDB\\Driver\\WriteResult <class.mongodb-driver-writeresult>` object.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Example
Example
-------
-------
...
...
docs/reference/method/MongoDBCollection-listIndexes.txt
View file @
4fd37901
...
@@ -35,6 +35,12 @@ Return Values
...
@@ -35,6 +35,12 @@ Return Values
A traversable :phpclass:`MongoDB\\Model\\IndexInfoIterator`, which contains a
A traversable :phpclass:`MongoDB\\Model\\IndexInfoIterator`, which contains a
:phpclass:`MongoDB\\Model\\IndexInfo` object for each index for the collection.
:phpclass:`MongoDB\\Model\\IndexInfo` object for each index for the collection.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Example
Example
-------
-------
...
...
docs/reference/method/MongoDBCollection-replaceOne.txt
View file @
4fd37901
...
@@ -37,6 +37,13 @@ Return Values
...
@@ -37,6 +37,13 @@ Return Values
A :phpclass:`MongoDB\\UpdateResult` object, which encapsulates a
A :phpclass:`MongoDB\\UpdateResult` object, which encapsulates a
:php:`MongoDB\\Driver\\WriteResult <class.mongodb-driver-writeresult>` object.
:php:`MongoDB\\Driver\\WriteResult <class.mongodb-driver-writeresult>` object.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unsupportedexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Example
Example
-------
-------
...
...
docs/reference/method/MongoDBCollection-updateMany.txt
View file @
4fd37901
...
@@ -35,6 +35,13 @@ Return Values
...
@@ -35,6 +35,13 @@ Return Values
A :phpclass:`MongoDB\\UpdateResult` object, which encapsulates a
A :phpclass:`MongoDB\\UpdateResult` object, which encapsulates a
:php:`MongoDB\\Driver\\WriteResult <class.mongodb-driver-writeresult>` object.
:php:`MongoDB\\Driver\\WriteResult <class.mongodb-driver-writeresult>` object.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unsupportedexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Examples
Examples
--------
--------
...
...
docs/reference/method/MongoDBCollection-updateOne.txt
View file @
4fd37901
...
@@ -37,6 +37,13 @@ Return Values
...
@@ -37,6 +37,13 @@ Return Values
A :phpclass:`MongoDB\\UpdateResult` object, which encapsulates a
A :phpclass:`MongoDB\\UpdateResult` object, which encapsulates a
:php:`MongoDB\\Driver\\WriteResult <class.mongodb-driver-writeresult>` object.
:php:`MongoDB\\Driver\\WriteResult <class.mongodb-driver-writeresult>` object.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unsupportedexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Examples
Examples
--------
--------
...
...
docs/reference/method/MongoDBCollection-withOptions.txt
View file @
4fd37901
...
@@ -34,6 +34,11 @@ Return Values
...
@@ -34,6 +34,11 @@ Return Values
A :phpclass:`MongoDB\\Collection` object.
A :phpclass:`MongoDB\\Collection` object.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-invalidargumentexception.rst
Example
Example
-------
-------
...
...
docs/reference/method/MongoDBCollection__construct.txt
View file @
4fd37901
...
@@ -29,6 +29,11 @@ Definition
...
@@ -29,6 +29,11 @@ Definition
.. include:: /includes/apiargs/MongoDBCollection-method-construct-option.rst
.. include:: /includes/apiargs/MongoDBCollection-method-construct-option.rst
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-invalidargumentexception.rst
Behavior
Behavior
--------
--------
...
...
docs/reference/method/MongoDBDatabase-command.txt
View file @
4fd37901
...
@@ -34,6 +34,12 @@ Return Values
...
@@ -34,6 +34,12 @@ Return Values
A :php:`MongoDB\\Driver\\Cursor <class.mongodb-driver-cursor>` object.
A :php:`MongoDB\\Driver\\Cursor <class.mongodb-driver-cursor>` object.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Example
Example
-------
-------
...
...
docs/reference/method/MongoDBDatabase-createCollection.txt
View file @
4fd37901
...
@@ -53,6 +53,13 @@ Return Values
...
@@ -53,6 +53,13 @@ Return Values
An array or object with the result document of the :manual:`create
An array or object with the result document of the :manual:`create
</reference/command/create>` command.
</reference/command/create>` command.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unsupportedexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Example
Example
-------
-------
...
...
docs/reference/method/MongoDBDatabase-drop.txt
View file @
4fd37901
...
@@ -36,6 +36,13 @@ An array or object with the result document of the :manual:`dropDatabase
...
@@ -36,6 +36,13 @@ An array or object with the result document of the :manual:`dropDatabase
</reference/command/dropDatabase>` command. The return type will depend on the
</reference/command/dropDatabase>` command. The return type will depend on the
``typeMap`` option.
``typeMap`` option.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unsupportedexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Example
Example
-------
-------
...
...
docs/reference/method/MongoDBDatabase-dropCollection.txt
View file @
4fd37901
...
@@ -36,6 +36,13 @@ An array or object with the result document of the :manual:`drop
...
@@ -36,6 +36,13 @@ An array or object with the result document of the :manual:`drop
</reference/command/drop>` command. The return type will depend on the
</reference/command/drop>` command. The return type will depend on the
``typeMap`` option.
``typeMap`` option.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unsupportedexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Example
Example
-------
-------
...
...
docs/reference/method/MongoDBDatabase-selectCollection.txt
View file @
4fd37901
...
@@ -34,6 +34,11 @@ Return Values
...
@@ -34,6 +34,11 @@ Return Values
A :phpclass:`MongoDB\\Collection` object.
A :phpclass:`MongoDB\\Collection` object.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-invalidargumentexception.rst
Behavior
Behavior
--------
--------
...
...
docs/reference/method/MongoDBDatabase-selectGridFSBucket.txt
View file @
4fd37901
...
@@ -34,6 +34,11 @@ Return Values
...
@@ -34,6 +34,11 @@ Return Values
A :phpclass:`MongoDB\\GridFS\\Bucket` object.
A :phpclass:`MongoDB\\GridFS\\Bucket` object.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-invalidargumentexception.rst
Behavior
Behavior
--------
--------
...
...
docs/reference/method/MongoDBDatabase-withOptions.txt
View file @
4fd37901
...
@@ -34,6 +34,11 @@ Return Values
...
@@ -34,6 +34,11 @@ Return Values
A :phpclass:`MongoDB\\Database` object.
A :phpclass:`MongoDB\\Database` object.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-invalidargumentexception.rst
Example
Example
-------
-------
...
...
docs/reference/method/MongoDBDatabase__construct.txt
View file @
4fd37901
...
@@ -29,6 +29,11 @@ Definition
...
@@ -29,6 +29,11 @@ Definition
.. include:: /includes/apiargs/MongoDBDatabase-method-construct-option.rst
.. include:: /includes/apiargs/MongoDBDatabase-method-construct-option.rst
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-invalidargumentexception.rst
Behavior
Behavior
--------
--------
...
...
src/Client.php
View file @
4fd37901
...
@@ -4,7 +4,11 @@ namespace MongoDB;
...
@@ -4,7 +4,11 @@ namespace MongoDB;
use
MongoDB\Driver\Manager
;
use
MongoDB\Driver\Manager
;
use
MongoDB\Driver\ReadPreference
;
use
MongoDB\Driver\ReadPreference
;
use
MongoDB\Driver\Exception\RuntimeException
as
DriverRuntimeException
;
use
MongoDB\Driver\Exception\InvalidArgumentException
as
DriverInvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\UnexpectedValueException
;
use
MongoDB\Exception\UnsupportedException
;
use
MongoDB\Model\DatabaseInfoIterator
;
use
MongoDB\Model\DatabaseInfoIterator
;
use
MongoDB\Operation\DropDatabase
;
use
MongoDB\Operation\DropDatabase
;
use
MongoDB\Operation\ListDatabases
;
use
MongoDB\Operation\ListDatabases
;
...
@@ -41,7 +45,9 @@ class Client
...
@@ -41,7 +45,9 @@ class Client
* @param string $uri MongoDB connection string
* @param string $uri MongoDB connection string
* @param array $uriOptions Additional connection string options
* @param array $uriOptions Additional connection string options
* @param array $driverOptions Driver-specific options
* @param array $driverOptions Driver-specific options
* @throws InvalidArgumentException
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverInvalidArgumentException for parameter/option parsing errors in the driver
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
__construct
(
$uri
=
'mongodb://127.0.0.1/'
,
array
$uriOptions
=
[],
array
$driverOptions
=
[])
public
function
__construct
(
$uri
=
'mongodb://127.0.0.1/'
,
array
$uriOptions
=
[],
array
$driverOptions
=
[])
{
{
...
@@ -108,6 +114,9 @@ class Client
...
@@ -108,6 +114,9 @@ class Client
* @param string $databaseName Database name
* @param string $databaseName Database name
* @param array $options Additional options
* @param array $options Additional options
* @return array|object Command result document
* @return array|object Command result document
* @throws UnsupportedException if options are unsupported on the selected server
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
dropDatabase
(
$databaseName
,
array
$options
=
[])
public
function
dropDatabase
(
$databaseName
,
array
$options
=
[])
{
{
...
@@ -141,6 +150,9 @@ class Client
...
@@ -141,6 +150,9 @@ class Client
*
*
* @see ListDatabases::__construct() for supported options
* @see ListDatabases::__construct() for supported options
* @return DatabaseInfoIterator
* @return DatabaseInfoIterator
* @throws UnexpectedValueException if the command response was malformed
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
listDatabases
(
array
$options
=
[])
public
function
listDatabases
(
array
$options
=
[])
{
{
...
@@ -158,6 +170,7 @@ class Client
...
@@ -158,6 +170,7 @@ class Client
* @param string $collectionName Name of the collection to select
* @param string $collectionName Name of the collection to select
* @param array $options Collection constructor options
* @param array $options Collection constructor options
* @return Collection
* @return Collection
* @throws InvalidArgumentException for parameter/option parsing errors
*/
*/
public
function
selectCollection
(
$databaseName
,
$collectionName
,
array
$options
=
[])
public
function
selectCollection
(
$databaseName
,
$collectionName
,
array
$options
=
[])
{
{
...
@@ -173,6 +186,7 @@ class Client
...
@@ -173,6 +186,7 @@ class Client
* @param string $databaseName Name of the database to select
* @param string $databaseName Name of the database to select
* @param array $options Database constructor options
* @param array $options Database constructor options
* @return Database
* @return Database
* @throws InvalidArgumentException for parameter/option parsing errors
*/
*/
public
function
selectDatabase
(
$databaseName
,
array
$options
=
[])
public
function
selectDatabase
(
$databaseName
,
array
$options
=
[])
{
{
...
...
src/Collection.php
View file @
4fd37901
...
@@ -7,7 +7,10 @@ use MongoDB\Driver\Manager;
...
@@ -7,7 +7,10 @@ use MongoDB\Driver\Manager;
use
MongoDB\Driver\ReadConcern
;
use
MongoDB\Driver\ReadConcern
;
use
MongoDB\Driver\ReadPreference
;
use
MongoDB\Driver\ReadPreference
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Driver\Exception\RuntimeException
as
DriverRuntimeException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\UnexpectedValueException
;
use
MongoDB\Exception\UnsupportedException
;
use
MongoDB\Model\IndexInfoIterator
;
use
MongoDB\Model\IndexInfoIterator
;
use
MongoDB\Operation\Aggregate
;
use
MongoDB\Operation\Aggregate
;
use
MongoDB\Operation\BulkWrite
;
use
MongoDB\Operation\BulkWrite
;
...
@@ -74,7 +77,7 @@ class Collection
...
@@ -74,7 +77,7 @@ class Collection
* @param string $databaseName Database name
* @param string $databaseName Database name
* @param string $collectionName Collection name
* @param string $collectionName Collection name
* @param array $options Collection options
* @param array $options Collection options
* @throws InvalidArgumentException
* @throws InvalidArgumentException
for parameter/option parsing errors
*/
*/
public
function
__construct
(
Manager
$manager
,
$databaseName
,
$collectionName
,
array
$options
=
[])
public
function
__construct
(
Manager
$manager
,
$databaseName
,
$collectionName
,
array
$options
=
[])
{
{
...
@@ -157,6 +160,10 @@ class Collection
...
@@ -157,6 +160,10 @@ class Collection
* @param array $pipeline List of pipeline operations
* @param array $pipeline List of pipeline operations
* @param array $options Command options
* @param array $options Command options
* @return Traversable
* @return Traversable
* @throws UnexpectedValueException if the command response was malformed
* @throws UnsupportedException if options are not supported by the selected server
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
aggregate
(
array
$pipeline
,
array
$options
=
[])
public
function
aggregate
(
array
$pipeline
,
array
$options
=
[])
{
{
...
@@ -199,6 +206,9 @@ class Collection
...
@@ -199,6 +206,9 @@ class Collection
* @param array[] $operations List of write operations
* @param array[] $operations List of write operations
* @param array $options Command options
* @param array $options Command options
* @return BulkWriteResult
* @return BulkWriteResult
* @throws UnsupportedException if options are not supported by the selected server
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
bulkWrite
(
array
$operations
,
array
$options
=
[])
public
function
bulkWrite
(
array
$operations
,
array
$options
=
[])
{
{
...
@@ -219,6 +229,10 @@ class Collection
...
@@ -219,6 +229,10 @@ class Collection
* @param array|object $filter Query by which to filter documents
* @param array|object $filter Query by which to filter documents
* @param array $options Command options
* @param array $options Command options
* @return integer
* @return integer
* @throws UnexpectedValueException if the command response was malformed
* @throws UnsupportedException if options are not supported by the selected server
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
count
(
$filter
=
[],
array
$options
=
[])
public
function
count
(
$filter
=
[],
array
$options
=
[])
{
{
...
@@ -245,6 +259,9 @@ class Collection
...
@@ -245,6 +259,9 @@ class Collection
* which denote order or an index type
* which denote order or an index type
* @param array $options Index options
* @param array $options Index options
* @return string The name of the created index
* @return string The name of the created index
* @throws UnsupportedException if options are not supported by the selected server
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
createIndex
(
$key
,
array
$options
=
[])
public
function
createIndex
(
$key
,
array
$options
=
[])
{
{
...
@@ -277,7 +294,9 @@ class Collection
...
@@ -277,7 +294,9 @@ class Collection
* @param array[] $indexes List of index specifications
* @param array[] $indexes List of index specifications
* @param array $options Command options
* @param array $options Command options
* @return string[] The names of the created indexes
* @return string[] The names of the created indexes
* @throws InvalidArgumentException if an index specification is invalid
* @throws UnsupportedException if options are not supported by the selected server
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
createIndexes
(
array
$indexes
,
array
$options
=
[])
public
function
createIndexes
(
array
$indexes
,
array
$options
=
[])
{
{
...
@@ -300,6 +319,9 @@ class Collection
...
@@ -300,6 +319,9 @@ class Collection
* @param array|object $filter Query by which to delete documents
* @param array|object $filter Query by which to delete documents
* @param array $options Command options
* @param array $options Command options
* @return DeleteResult
* @return DeleteResult
* @throws UnsupportedException if options are not supported by the selected server
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
deleteMany
(
$filter
,
array
$options
=
[])
public
function
deleteMany
(
$filter
,
array
$options
=
[])
{
{
...
@@ -321,6 +343,9 @@ class Collection
...
@@ -321,6 +343,9 @@ class Collection
* @param array|object $filter Query by which to delete documents
* @param array|object $filter Query by which to delete documents
* @param array $options Command options
* @param array $options Command options
* @return DeleteResult
* @return DeleteResult
* @throws UnsupportedException if options are not supported by the selected server
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
deleteOne
(
$filter
,
array
$options
=
[])
public
function
deleteOne
(
$filter
,
array
$options
=
[])
{
{
...
@@ -342,6 +367,10 @@ class Collection
...
@@ -342,6 +367,10 @@ class Collection
* @param array|object $filter Query by which to filter documents
* @param array|object $filter Query by which to filter documents
* @param array $options Command options
* @param array $options Command options
* @return mixed[]
* @return mixed[]
* @throws UnexpectedValueException if the command response was malformed
* @throws UnsupportedException if options are not supported by the selected server
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
distinct
(
$fieldName
,
$filter
=
[],
array
$options
=
[])
public
function
distinct
(
$fieldName
,
$filter
=
[],
array
$options
=
[])
{
{
...
@@ -365,6 +394,9 @@ class Collection
...
@@ -365,6 +394,9 @@ class Collection
* @see DropCollection::__construct() for supported options
* @see DropCollection::__construct() for supported options
* @param array $options Additional options
* @param array $options Additional options
* @return array|object Command result document
* @return array|object Command result document
* @throws UnsupportedException if options are not supported by the selected server
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
drop
(
array
$options
=
[])
public
function
drop
(
array
$options
=
[])
{
{
...
@@ -390,7 +422,9 @@ class Collection
...
@@ -390,7 +422,9 @@ class Collection
* @param string $indexName Index name
* @param string $indexName Index name
* @param array $options Additional options
* @param array $options Additional options
* @return array|object Command result document
* @return array|object Command result document
* @throws InvalidArgumentException if $indexName is an empty string or "*"
* @throws UnsupportedException if options are not supported by the selected server
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
dropIndex
(
$indexName
,
array
$options
=
[])
public
function
dropIndex
(
$indexName
,
array
$options
=
[])
{
{
...
@@ -421,6 +455,9 @@ class Collection
...
@@ -421,6 +455,9 @@ class Collection
* @see DropIndexes::__construct() for supported options
* @see DropIndexes::__construct() for supported options
* @param array $options Additional options
* @param array $options Additional options
* @return array|object Command result document
* @return array|object Command result document
* @throws UnsupportedException if options are not supported by the selected server
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
dropIndexes
(
array
$options
=
[])
public
function
dropIndexes
(
array
$options
=
[])
{
{
...
@@ -447,6 +484,9 @@ class Collection
...
@@ -447,6 +484,9 @@ class Collection
* @param array|object $filter Query by which to filter documents
* @param array|object $filter Query by which to filter documents
* @param array $options Additional options
* @param array $options Additional options
* @return Cursor
* @return Cursor
* @throws UnsupportedException if options are not supported by the selected server
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
find
(
$filter
=
[],
array
$options
=
[])
public
function
find
(
$filter
=
[],
array
$options
=
[])
{
{
...
@@ -476,6 +516,9 @@ class Collection
...
@@ -476,6 +516,9 @@ class Collection
* @param array|object $filter Query by which to filter documents
* @param array|object $filter Query by which to filter documents
* @param array $options Additional options
* @param array $options Additional options
* @return array|object|null
* @return array|object|null
* @throws UnsupportedException if options are not supported by the selected server
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
findOne
(
$filter
=
[],
array
$options
=
[])
public
function
findOne
(
$filter
=
[],
array
$options
=
[])
{
{
...
@@ -510,6 +553,10 @@ class Collection
...
@@ -510,6 +553,10 @@ class Collection
* @param array|object $filter Query by which to filter documents
* @param array|object $filter Query by which to filter documents
* @param array $options Command options
* @param array $options Command options
* @return object|null
* @return object|null
* @throws UnexpectedValueException if the command response was malformed
* @throws UnsupportedException if options are not supported by the selected server
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
findOneAndDelete
(
$filter
,
array
$options
=
[])
public
function
findOneAndDelete
(
$filter
,
array
$options
=
[])
{
{
...
@@ -542,6 +589,10 @@ class Collection
...
@@ -542,6 +589,10 @@ class Collection
* @param array|object $replacement Replacement document
* @param array|object $replacement Replacement document
* @param array $options Command options
* @param array $options Command options
* @return object|null
* @return object|null
* @throws UnexpectedValueException if the command response was malformed
* @throws UnsupportedException if options are not supported by the selected server
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
findOneAndReplace
(
$filter
,
$replacement
,
array
$options
=
[])
public
function
findOneAndReplace
(
$filter
,
$replacement
,
array
$options
=
[])
{
{
...
@@ -574,6 +625,10 @@ class Collection
...
@@ -574,6 +625,10 @@ class Collection
* @param array|object $update Update to apply to the matched document
* @param array|object $update Update to apply to the matched document
* @param array $options Command options
* @param array $options Command options
* @return object|null
* @return object|null
* @throws UnexpectedValueException if the command response was malformed
* @throws UnsupportedException if options are not supported by the selected server
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
findOneAndUpdate
(
$filter
,
$update
,
array
$options
=
[])
public
function
findOneAndUpdate
(
$filter
,
$update
,
array
$options
=
[])
{
{
...
@@ -637,6 +692,8 @@ class Collection
...
@@ -637,6 +692,8 @@ class Collection
* @param array[]|object[] $documents The documents to insert
* @param array[]|object[] $documents The documents to insert
* @param array $options Command options
* @param array $options Command options
* @return InsertManyResult
* @return InsertManyResult
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
insertMany
(
array
$documents
,
array
$options
=
[])
public
function
insertMany
(
array
$documents
,
array
$options
=
[])
{
{
...
@@ -658,6 +715,8 @@ class Collection
...
@@ -658,6 +715,8 @@ class Collection
* @param array|object $document The document to insert
* @param array|object $document The document to insert
* @param array $options Command options
* @param array $options Command options
* @return InsertOneResult
* @return InsertOneResult
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
insertOne
(
$document
,
array
$options
=
[])
public
function
insertOne
(
$document
,
array
$options
=
[])
{
{
...
@@ -676,6 +735,8 @@ class Collection
...
@@ -676,6 +735,8 @@ class Collection
*
*
* @see ListIndexes::__construct() for supported options
* @see ListIndexes::__construct() for supported options
* @return IndexInfoIterator
* @return IndexInfoIterator
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
listIndexes
(
array
$options
=
[])
public
function
listIndexes
(
array
$options
=
[])
{
{
...
@@ -694,6 +755,9 @@ class Collection
...
@@ -694,6 +755,9 @@ class Collection
* @param array|object $replacement Replacement document
* @param array|object $replacement Replacement document
* @param array $options Command options
* @param array $options Command options
* @return UpdateResult
* @return UpdateResult
* @throws UnsupportedException if options are not supported by the selected server
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
replaceOne
(
$filter
,
$replacement
,
array
$options
=
[])
public
function
replaceOne
(
$filter
,
$replacement
,
array
$options
=
[])
{
{
...
@@ -716,6 +780,9 @@ class Collection
...
@@ -716,6 +780,9 @@ class Collection
* @param array|object $update Update to apply to the matched documents
* @param array|object $update Update to apply to the matched documents
* @param array $options Command options
* @param array $options Command options
* @return UpdateResult
* @return UpdateResult
* @throws UnsupportedException if options are not supported by the selected server
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
updateMany
(
$filter
,
$update
,
array
$options
=
[])
public
function
updateMany
(
$filter
,
$update
,
array
$options
=
[])
{
{
...
@@ -738,6 +805,9 @@ class Collection
...
@@ -738,6 +805,9 @@ class Collection
* @param array|object $update Update to apply to the matched document
* @param array|object $update Update to apply to the matched document
* @param array $options Command options
* @param array $options Command options
* @return UpdateResult
* @return UpdateResult
* @throws UnsupportedException if options are not supported by the selected server
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
updateOne
(
$filter
,
$update
,
array
$options
=
[])
public
function
updateOne
(
$filter
,
$update
,
array
$options
=
[])
{
{
...
@@ -757,6 +827,7 @@ class Collection
...
@@ -757,6 +827,7 @@ class Collection
* @see Collection::__construct() for supported options
* @see Collection::__construct() for supported options
* @param array $options Collection constructor options
* @param array $options Collection constructor options
* @return Collection
* @return Collection
* @throws InvalidArgumentException for parameter/option parsing errors
*/
*/
public
function
withOptions
(
array
$options
=
[])
public
function
withOptions
(
array
$options
=
[])
{
{
...
...
src/Database.php
View file @
4fd37901
...
@@ -8,7 +8,9 @@ use MongoDB\Driver\Manager;
...
@@ -8,7 +8,9 @@ use MongoDB\Driver\Manager;
use
MongoDB\Driver\ReadConcern
;
use
MongoDB\Driver\ReadConcern
;
use
MongoDB\Driver\ReadPreference
;
use
MongoDB\Driver\ReadPreference
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Driver\Exception\RuntimeException
as
DriverRuntimeException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\UnsupportedException
;
use
MongoDB\GridFS\Bucket
;
use
MongoDB\GridFS\Bucket
;
use
MongoDB\Model\CollectionInfoIterator
;
use
MongoDB\Model\CollectionInfoIterator
;
use
MongoDB\Operation\CreateCollection
;
use
MongoDB\Operation\CreateCollection
;
...
@@ -58,7 +60,7 @@ class Database
...
@@ -58,7 +60,7 @@ class Database
* @param Manager $manager Manager instance from the driver
* @param Manager $manager Manager instance from the driver
* @param string $databaseName Database name
* @param string $databaseName Database name
* @param array $options Database options
* @param array $options Database options
* @throws InvalidArgumentException
* @throws InvalidArgumentException
for parameter/option parsing errors
*/
*/
public
function
__construct
(
Manager
$manager
,
$databaseName
,
array
$options
=
[])
public
function
__construct
(
Manager
$manager
,
$databaseName
,
array
$options
=
[])
{
{
...
@@ -142,7 +144,8 @@ class Database
...
@@ -142,7 +144,8 @@ class Database
* @param array|object $command Command document
* @param array|object $command Command document
* @param array $options Options for command execution
* @param array $options Options for command execution
* @return Cursor
* @return Cursor
* @throws InvalidArgumentException
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
command
(
$command
,
array
$options
=
[])
public
function
command
(
$command
,
array
$options
=
[])
{
{
...
@@ -167,6 +170,9 @@ class Database
...
@@ -167,6 +170,9 @@ class Database
* @param string $collectionName
* @param string $collectionName
* @param array $options
* @param array $options
* @return array|object Command result document
* @return array|object Command result document
* @throws UnsupportedException if options are not supported by the selected server
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
createCollection
(
$collectionName
,
array
$options
=
[])
public
function
createCollection
(
$collectionName
,
array
$options
=
[])
{
{
...
@@ -191,6 +197,9 @@ class Database
...
@@ -191,6 +197,9 @@ class Database
* @see DropDatabase::__construct() for supported options
* @see DropDatabase::__construct() for supported options
* @param array $options Additional options
* @param array $options Additional options
* @return array|object Command result document
* @return array|object Command result document
* @throws UnsupportedException if options are unsupported on the selected server
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
drop
(
array
$options
=
[])
public
function
drop
(
array
$options
=
[])
{
{
...
@@ -216,6 +225,9 @@ class Database
...
@@ -216,6 +225,9 @@ class Database
* @param string $collectionName Collection name
* @param string $collectionName Collection name
* @param array $options Additional options
* @param array $options Additional options
* @return array|object Command result document
* @return array|object Command result document
* @throws UnsupportedException if options are unsupported on the selected server
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
dropCollection
(
$collectionName
,
array
$options
=
[])
public
function
dropCollection
(
$collectionName
,
array
$options
=
[])
{
{
...
@@ -260,6 +272,8 @@ class Database
...
@@ -260,6 +272,8 @@ class Database
* @see ListCollections::__construct() for supported options
* @see ListCollections::__construct() for supported options
* @param array $options
* @param array $options
* @return CollectionInfoIterator
* @return CollectionInfoIterator
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
listCollections
(
array
$options
=
[])
public
function
listCollections
(
array
$options
=
[])
{
{
...
@@ -276,6 +290,7 @@ class Database
...
@@ -276,6 +290,7 @@ class Database
* @param string $collectionName Name of the collection to select
* @param string $collectionName Name of the collection to select
* @param array $options Collection constructor options
* @param array $options Collection constructor options
* @return Collection
* @return Collection
* @throws InvalidArgumentException for parameter/option parsing errors
*/
*/
public
function
selectCollection
(
$collectionName
,
array
$options
=
[])
public
function
selectCollection
(
$collectionName
,
array
$options
=
[])
{
{
...
@@ -295,6 +310,7 @@ class Database
...
@@ -295,6 +310,7 @@ class Database
* @see Bucket::__construct() for supported options
* @see Bucket::__construct() for supported options
* @param array $options Bucket constructor options
* @param array $options Bucket constructor options
* @return Bucket
* @return Bucket
* @throws InvalidArgumentException for parameter/option parsing errors
*/
*/
public
function
selectGridFSBucket
(
array
$options
=
[])
public
function
selectGridFSBucket
(
array
$options
=
[])
{
{
...
@@ -313,6 +329,7 @@ class Database
...
@@ -313,6 +329,7 @@ class Database
* @see Database::__construct() for supported options
* @see Database::__construct() for supported options
* @param array $options Database constructor options
* @param array $options Database constructor options
* @return Database
* @return Database
* @throws InvalidArgumentException for parameter/option parsing errors
*/
*/
public
function
withOptions
(
array
$options
=
[])
public
function
withOptions
(
array
$options
=
[])
{
{
...
...
src/Operation/Aggregate.php
View file @
4fd37901
...
@@ -7,6 +7,7 @@ use MongoDB\Driver\ReadConcern;
...
@@ -7,6 +7,7 @@ use MongoDB\Driver\ReadConcern;
use
MongoDB\Driver\ReadPreference
;
use
MongoDB\Driver\ReadPreference
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Driver\Exception\RuntimeException
as
DriverRuntimeException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\UnexpectedValueException
;
use
MongoDB\Exception\UnexpectedValueException
;
use
MongoDB\Exception\UnsupportedException
;
use
MongoDB\Exception\UnsupportedException
;
...
@@ -93,7 +94,7 @@ class Aggregate implements Executable
...
@@ -93,7 +94,7 @@ class Aggregate implements Executable
* @param string $collectionName Collection name
* @param string $collectionName Collection name
* @param array $pipeline List of pipeline operations
* @param array $pipeline List of pipeline operations
* @param array $options Command options
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException
for parameter/option parsing errors
*/
*/
public
function
__construct
(
$databaseName
,
$collectionName
,
array
$pipeline
,
array
$options
=
[])
public
function
__construct
(
$databaseName
,
$collectionName
,
array
$pipeline
,
array
$options
=
[])
{
{
...
@@ -182,6 +183,7 @@ class Aggregate implements Executable
...
@@ -182,6 +183,7 @@ class Aggregate implements Executable
* @return Traversable
* @return Traversable
* @throws UnexpectedValueException if the command response was malformed
* @throws UnexpectedValueException if the command response was malformed
* @throws UnsupportedException if collation or write concern is used and unsupported
* @throws UnsupportedException if collation or write concern is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
execute
(
Server
$server
)
public
function
execute
(
Server
$server
)
{
{
...
...
src/Operation/BulkWrite.php
View file @
4fd37901
...
@@ -6,6 +6,7 @@ use MongoDB\BulkWriteResult;
...
@@ -6,6 +6,7 @@ use MongoDB\BulkWriteResult;
use
MongoDB\Driver\BulkWrite
as
Bulk
;
use
MongoDB\Driver\BulkWrite
as
Bulk
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Driver\Exception\RuntimeException
as
DriverRuntimeException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\UnsupportedException
;
use
MongoDB\Exception\UnsupportedException
;
...
@@ -83,7 +84,7 @@ class BulkWrite implements Executable
...
@@ -83,7 +84,7 @@ class BulkWrite implements Executable
* @param string $collectionName Collection name
* @param string $collectionName Collection name
* @param array[] $operations List of write operations
* @param array[] $operations List of write operations
* @param array $options Command options
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException
for parameter/option parsing errors
*/
*/
public
function
__construct
(
$databaseName
,
$collectionName
,
array
$operations
,
array
$options
=
[])
public
function
__construct
(
$databaseName
,
$collectionName
,
array
$operations
,
array
$options
=
[])
{
{
...
@@ -260,6 +261,7 @@ class BulkWrite implements Executable
...
@@ -260,6 +261,7 @@ class BulkWrite implements Executable
* @param Server $server
* @param Server $server
* @return BulkWriteResult
* @return BulkWriteResult
* @throws UnsupportedException if collation is used and unsupported
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
execute
(
Server
$server
)
public
function
execute
(
Server
$server
)
{
{
...
...
src/Operation/Count.php
View file @
4fd37901
...
@@ -6,6 +6,7 @@ use MongoDB\Driver\Command;
...
@@ -6,6 +6,7 @@ use MongoDB\Driver\Command;
use
MongoDB\Driver\ReadConcern
;
use
MongoDB\Driver\ReadConcern
;
use
MongoDB\Driver\ReadPreference
;
use
MongoDB\Driver\ReadPreference
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Exception\RuntimeException
as
DriverRuntimeException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\UnexpectedValueException
;
use
MongoDB\Exception\UnexpectedValueException
;
use
MongoDB\Exception\UnsupportedException
;
use
MongoDB\Exception\UnsupportedException
;
...
@@ -59,7 +60,7 @@ class Count implements Executable
...
@@ -59,7 +60,7 @@ class Count implements Executable
* @param string $collectionName Collection name
* @param string $collectionName Collection name
* @param array|object $filter Query by which to filter documents
* @param array|object $filter Query by which to filter documents
* @param array $options Command options
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException
for parameter/option parsing errors
*/
*/
public
function
__construct
(
$databaseName
,
$collectionName
,
$filter
=
[],
array
$options
=
[])
public
function
__construct
(
$databaseName
,
$collectionName
,
$filter
=
[],
array
$options
=
[])
{
{
...
@@ -115,6 +116,7 @@ class Count implements Executable
...
@@ -115,6 +116,7 @@ class Count implements Executable
* @return integer
* @return integer
* @throws UnexpectedValueException if the command response was malformed
* @throws UnexpectedValueException if the command response was malformed
* @throws UnsupportedException if collation is used and unsupported
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
execute
(
Server
$server
)
public
function
execute
(
Server
$server
)
{
{
...
...
src/Operation/CreateCollection.php
View file @
4fd37901
...
@@ -5,6 +5,7 @@ namespace MongoDB\Operation;
...
@@ -5,6 +5,7 @@ namespace MongoDB\Operation;
use
MongoDB\Driver\Command
;
use
MongoDB\Driver\Command
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Driver\Exception\RuntimeException
as
DriverRuntimeException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\UnsupportedException
;
use
MongoDB\Exception\UnsupportedException
;
...
@@ -81,7 +82,7 @@ class CreateCollection implements Executable
...
@@ -81,7 +82,7 @@ class CreateCollection implements Executable
* @param string $databaseName Database name
* @param string $databaseName Database name
* @param string $collectionName Collection name
* @param string $collectionName Collection name
* @param array $options Command options
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException
for parameter/option parsing errors
*/
*/
public
function
__construct
(
$databaseName
,
$collectionName
,
array
$options
=
[])
public
function
__construct
(
$databaseName
,
$collectionName
,
array
$options
=
[])
{
{
...
@@ -153,6 +154,7 @@ class CreateCollection implements Executable
...
@@ -153,6 +154,7 @@ class CreateCollection implements Executable
* @param Server $server
* @param Server $server
* @return array|object Command result document
* @return array|object Command result document
* @throws UnsupportedException if collation or write concern is used and unsupported
* @throws UnsupportedException if collation or write concern is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
execute
(
Server
$server
)
public
function
execute
(
Server
$server
)
{
{
...
...
src/Operation/CreateIndexes.php
View file @
4fd37901
...
@@ -6,6 +6,7 @@ use MongoDB\Driver\Command;
...
@@ -6,6 +6,7 @@ use MongoDB\Driver\Command;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\BulkWrite
as
Bulk
;
use
MongoDB\Driver\BulkWrite
as
Bulk
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Driver\Exception\RuntimeException
as
DriverRuntimeException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\UnsupportedException
;
use
MongoDB\Exception\UnsupportedException
;
use
MongoDB\Model\IndexInput
;
use
MongoDB\Model\IndexInput
;
...
@@ -44,7 +45,7 @@ class CreateIndexes implements Executable
...
@@ -44,7 +45,7 @@ class CreateIndexes implements Executable
* @param string $collectionName Collection name
* @param string $collectionName Collection name
* @param array[] $indexes List of index specifications
* @param array[] $indexes List of index specifications
* @param array $options Command options
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException
for parameter/option parsing errors
*/
*/
public
function
__construct
(
$databaseName
,
$collectionName
,
array
$indexes
,
array
$options
=
[])
public
function
__construct
(
$databaseName
,
$collectionName
,
array
$indexes
,
array
$options
=
[])
{
{
...
@@ -95,6 +96,7 @@ class CreateIndexes implements Executable
...
@@ -95,6 +96,7 @@ class CreateIndexes implements Executable
* @param Server $server
* @param Server $server
* @return string[] The names of the created indexes
* @return string[] The names of the created indexes
* @throws UnsupportedException if collation or write concern is used and unsupported
* @throws UnsupportedException if collation or write concern is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
execute
(
Server
$server
)
public
function
execute
(
Server
$server
)
{
{
...
@@ -120,6 +122,7 @@ class CreateIndexes implements Executable
...
@@ -120,6 +122,7 @@ class CreateIndexes implements Executable
* command.
* command.
*
*
* @param Server $server
* @param Server $server
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
private
function
executeCommand
(
Server
$server
)
private
function
executeCommand
(
Server
$server
)
{
{
...
@@ -140,6 +143,7 @@ class CreateIndexes implements Executable
...
@@ -140,6 +143,7 @@ class CreateIndexes implements Executable
* "system.indexes" collection (MongoDB <2.6).
* "system.indexes" collection (MongoDB <2.6).
*
*
* @param Server $server
* @param Server $server
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
private
function
executeLegacy
(
Server
$server
)
private
function
executeLegacy
(
Server
$server
)
{
{
...
...
src/Operation/DatabaseCommand.php
View file @
4fd37901
...
@@ -6,6 +6,7 @@ use MongoDB\Driver\Command;
...
@@ -6,6 +6,7 @@ use MongoDB\Driver\Command;
use
MongoDB\Driver\Cursor
;
use
MongoDB\Driver\Cursor
;
use
MongoDB\Driver\ReadPreference
;
use
MongoDB\Driver\ReadPreference
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Exception\RuntimeException
as
DriverRuntimeException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
/**
/**
...
@@ -37,7 +38,7 @@ class DatabaseCommand implements Executable
...
@@ -37,7 +38,7 @@ class DatabaseCommand implements Executable
* @param string $databaseName Database name
* @param string $databaseName Database name
* @param array|object $command Command document
* @param array|object $command Command document
* @param array $options Options for command execution
* @param array $options Options for command execution
* @throws InvalidArgumentException
* @throws InvalidArgumentException
for parameter/option parsing errors
*/
*/
public
function
__construct
(
$databaseName
,
$command
,
array
$options
=
[])
public
function
__construct
(
$databaseName
,
$command
,
array
$options
=
[])
{
{
...
...
src/Operation/Delete.php
View file @
4fd37901
...
@@ -6,6 +6,7 @@ use MongoDB\DeleteResult;
...
@@ -6,6 +6,7 @@ use MongoDB\DeleteResult;
use
MongoDB\Driver\BulkWrite
as
Bulk
;
use
MongoDB\Driver\BulkWrite
as
Bulk
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Driver\Exception\RuntimeException
as
DriverRuntimeException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\UnsupportedException
;
use
MongoDB\Exception\UnsupportedException
;
...
@@ -47,7 +48,7 @@ class Delete implements Executable
...
@@ -47,7 +48,7 @@ class Delete implements Executable
* delete. Must be 0 or 1, for all or a
* delete. Must be 0 or 1, for all or a
* single document, respectively.
* single document, respectively.
* @param array $options Command options
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException
for parameter/option parsing errors
*/
*/
public
function
__construct
(
$databaseName
,
$collectionName
,
$filter
,
$limit
,
array
$options
=
[])
public
function
__construct
(
$databaseName
,
$collectionName
,
$filter
,
$limit
,
array
$options
=
[])
{
{
...
@@ -80,6 +81,7 @@ class Delete implements Executable
...
@@ -80,6 +81,7 @@ class Delete implements Executable
* @see Executable::execute()
* @see Executable::execute()
* @param Server $server
* @param Server $server
* @return DeleteResult
* @return DeleteResult
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
execute
(
Server
$server
)
public
function
execute
(
Server
$server
)
{
{
...
...
src/Operation/DeleteMany.php
View file @
4fd37901
...
@@ -4,6 +4,7 @@ namespace MongoDB\Operation;
...
@@ -4,6 +4,7 @@ namespace MongoDB\Operation;
use
MongoDB\DeleteResult
;
use
MongoDB\DeleteResult
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Exception\RuntimeException
as
DriverRuntimeException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\UnsupportedException
;
use
MongoDB\Exception\UnsupportedException
;
...
@@ -34,7 +35,7 @@ class DeleteMany implements Executable
...
@@ -34,7 +35,7 @@ class DeleteMany implements Executable
* @param string $collectionName Collection name
* @param string $collectionName Collection name
* @param array|object $filter Query by which to delete documents
* @param array|object $filter Query by which to delete documents
* @param array $options Command options
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException
for parameter/option parsing errors
*/
*/
public
function
__construct
(
$databaseName
,
$collectionName
,
$filter
,
array
$options
=
[])
public
function
__construct
(
$databaseName
,
$collectionName
,
$filter
,
array
$options
=
[])
{
{
...
@@ -48,6 +49,7 @@ class DeleteMany implements Executable
...
@@ -48,6 +49,7 @@ class DeleteMany implements Executable
* @param Server $server
* @param Server $server
* @return DeleteResult
* @return DeleteResult
* @throws UnsupportedException if collation is used and unsupported
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
execute
(
Server
$server
)
public
function
execute
(
Server
$server
)
{
{
...
...
src/Operation/DeleteOne.php
View file @
4fd37901
...
@@ -4,6 +4,7 @@ namespace MongoDB\Operation;
...
@@ -4,6 +4,7 @@ namespace MongoDB\Operation;
use
MongoDB\DeleteResult
;
use
MongoDB\DeleteResult
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Exception\RuntimeException
as
DriverRuntimeException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\UnsupportedException
;
use
MongoDB\Exception\UnsupportedException
;
...
@@ -34,7 +35,7 @@ class DeleteOne implements Executable
...
@@ -34,7 +35,7 @@ class DeleteOne implements Executable
* @param string $collectionName Collection name
* @param string $collectionName Collection name
* @param array|object $filter Query by which to delete documents
* @param array|object $filter Query by which to delete documents
* @param array $options Command options
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException
for parameter/option parsing errors
*/
*/
public
function
__construct
(
$databaseName
,
$collectionName
,
$filter
,
array
$options
=
[])
public
function
__construct
(
$databaseName
,
$collectionName
,
$filter
,
array
$options
=
[])
{
{
...
@@ -48,6 +49,7 @@ class DeleteOne implements Executable
...
@@ -48,6 +49,7 @@ class DeleteOne implements Executable
* @param Server $server
* @param Server $server
* @return DeleteResult
* @return DeleteResult
* @throws UnsupportedException if collation is used and unsupported
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
execute
(
Server
$server
)
public
function
execute
(
Server
$server
)
{
{
...
...
src/Operation/Distinct.php
View file @
4fd37901
...
@@ -6,6 +6,7 @@ use MongoDB\Driver\Command;
...
@@ -6,6 +6,7 @@ use MongoDB\Driver\Command;
use
MongoDB\Driver\ReadConcern
;
use
MongoDB\Driver\ReadConcern
;
use
MongoDB\Driver\ReadPreference
;
use
MongoDB\Driver\ReadPreference
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Exception\RuntimeException
as
DriverRuntimeException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\UnexpectedValueException
;
use
MongoDB\Exception\UnexpectedValueException
;
use
MongoDB\Exception\UnsupportedException
;
use
MongoDB\Exception\UnsupportedException
;
...
@@ -53,7 +54,7 @@ class Distinct implements Executable
...
@@ -53,7 +54,7 @@ class Distinct implements Executable
* @param string $fieldName Field for which to return distinct values
* @param string $fieldName Field for which to return distinct values
* @param array|object $filter Query by which to filter documents
* @param array|object $filter Query by which to filter documents
* @param array $options Command options
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException
for parameter/option parsing errors
*/
*/
public
function
__construct
(
$databaseName
,
$collectionName
,
$fieldName
,
$filter
=
[],
array
$options
=
[])
public
function
__construct
(
$databaseName
,
$collectionName
,
$fieldName
,
$filter
=
[],
array
$options
=
[])
{
{
...
@@ -92,6 +93,7 @@ class Distinct implements Executable
...
@@ -92,6 +93,7 @@ class Distinct implements Executable
* @return mixed[]
* @return mixed[]
* @throws UnexpectedValueException if the command response was malformed
* @throws UnexpectedValueException if the command response was malformed
* @throws UnsupportedException if collation is used and unsupported
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
execute
(
Server
$server
)
public
function
execute
(
Server
$server
)
{
{
...
...
src/Operation/DropCollection.php
View file @
4fd37901
...
@@ -5,7 +5,7 @@ namespace MongoDB\Operation;
...
@@ -5,7 +5,7 @@ namespace MongoDB\Operation;
use
MongoDB\Driver\Command
;
use
MongoDB\Driver\Command
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Driver\Exception\RuntimeException
;
use
MongoDB\Driver\Exception\RuntimeException
as
DriverRuntimeException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\UnsupportedException
;
use
MongoDB\Exception\UnsupportedException
;
...
@@ -42,6 +42,7 @@ class DropCollection implements Executable
...
@@ -42,6 +42,7 @@ class DropCollection implements Executable
* @param string $databaseName Database name
* @param string $databaseName Database name
* @param string $collectionName Collection name
* @param string $collectionName Collection name
* @param array $options Command options
* @param array $options Command options
* @throws InvalidArgumentException for parameter/option parsing errors
*/
*/
public
function
__construct
(
$databaseName
,
$collectionName
,
array
$options
=
[])
public
function
__construct
(
$databaseName
,
$collectionName
,
array
$options
=
[])
{
{
...
@@ -65,6 +66,7 @@ class DropCollection implements Executable
...
@@ -65,6 +66,7 @@ class DropCollection implements Executable
* @param Server $server
* @param Server $server
* @return array|object Command result document
* @return array|object Command result document
* @throws UnsupportedException if writeConcern is used and unsupported
* @throws UnsupportedException if writeConcern is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
execute
(
Server
$server
)
public
function
execute
(
Server
$server
)
{
{
...
@@ -74,7 +76,7 @@ class DropCollection implements Executable
...
@@ -74,7 +76,7 @@ class DropCollection implements Executable
try
{
try
{
$cursor
=
$server
->
executeCommand
(
$this
->
databaseName
,
$this
->
createCommand
());
$cursor
=
$server
->
executeCommand
(
$this
->
databaseName
,
$this
->
createCommand
());
}
catch
(
RuntimeException
$e
)
{
}
catch
(
Driver
RuntimeException
$e
)
{
/* The server may return an error if the collection does not exist.
/* The server may return an error if the collection does not exist.
* Check for an error message (unfortunately, there isn't a code)
* Check for an error message (unfortunately, there isn't a code)
* and NOP instead of throwing.
* and NOP instead of throwing.
...
...
src/Operation/DropDatabase.php
View file @
4fd37901
...
@@ -5,6 +5,7 @@ namespace MongoDB\Operation;
...
@@ -5,6 +5,7 @@ namespace MongoDB\Operation;
use
MongoDB\Driver\Command
;
use
MongoDB\Driver\Command
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Driver\Exception\RuntimeException
as
DriverRuntimeException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\UnsupportedException
;
use
MongoDB\Exception\UnsupportedException
;
...
@@ -38,6 +39,7 @@ class DropDatabase implements Executable
...
@@ -38,6 +39,7 @@ class DropDatabase implements Executable
*
*
* @param string $databaseName Database name
* @param string $databaseName Database name
* @param array $options Command options
* @param array $options Command options
* @throws InvalidArgumentException for parameter/option parsing errors
*/
*/
public
function
__construct
(
$databaseName
,
array
$options
=
[])
public
function
__construct
(
$databaseName
,
array
$options
=
[])
{
{
...
@@ -60,6 +62,7 @@ class DropDatabase implements Executable
...
@@ -60,6 +62,7 @@ class DropDatabase implements Executable
* @param Server $server
* @param Server $server
* @return array|object Command result document
* @return array|object Command result document
* @throws UnsupportedException if writeConcern is used and unsupported
* @throws UnsupportedException if writeConcern is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
execute
(
Server
$server
)
public
function
execute
(
Server
$server
)
{
{
...
...
src/Operation/DropIndexes.php
View file @
4fd37901
...
@@ -5,6 +5,7 @@ namespace MongoDB\Operation;
...
@@ -5,6 +5,7 @@ namespace MongoDB\Operation;
use
MongoDB\Driver\Command
;
use
MongoDB\Driver\Command
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Driver\Exception\RuntimeException
as
DriverRuntimeException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\UnsupportedException
;
use
MongoDB\Exception\UnsupportedException
;
...
@@ -41,7 +42,7 @@ class DropIndexes implements Executable
...
@@ -41,7 +42,7 @@ class DropIndexes implements Executable
* @param string $collectionName Collection name
* @param string $collectionName Collection name
* @param string $indexName Index name (use "*" to drop all indexes)
* @param string $indexName Index name (use "*" to drop all indexes)
* @param array $options Command options
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException
for parameter/option parsing errors
*/
*/
public
function
__construct
(
$databaseName
,
$collectionName
,
$indexName
,
array
$options
=
[])
public
function
__construct
(
$databaseName
,
$collectionName
,
$indexName
,
array
$options
=
[])
{
{
...
@@ -72,6 +73,7 @@ class DropIndexes implements Executable
...
@@ -72,6 +73,7 @@ class DropIndexes implements Executable
* @param Server $server
* @param Server $server
* @return array|object Command result document
* @return array|object Command result document
* @throws UnsupportedException if writeConcern is used and unsupported
* @throws UnsupportedException if writeConcern is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
execute
(
Server
$server
)
public
function
execute
(
Server
$server
)
{
{
...
...
src/Operation/Find.php
View file @
4fd37901
...
@@ -7,6 +7,7 @@ use MongoDB\Driver\Query;
...
@@ -7,6 +7,7 @@ use MongoDB\Driver\Query;
use
MongoDB\Driver\ReadConcern
;
use
MongoDB\Driver\ReadConcern
;
use
MongoDB\Driver\ReadPreference
;
use
MongoDB\Driver\ReadPreference
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Exception\RuntimeException
as
DriverRuntimeException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\UnsupportedException
;
use
MongoDB\Exception\UnsupportedException
;
...
@@ -92,7 +93,7 @@ class Find implements Executable
...
@@ -92,7 +93,7 @@ class Find implements Executable
* @param string $collectionName Collection name
* @param string $collectionName Collection name
* @param array|object $filter Query by which to filter documents
* @param array|object $filter Query by which to filter documents
* @param array $options Command options
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException
for parameter/option parsing errors
*/
*/
public
function
__construct
(
$databaseName
,
$collectionName
,
$filter
,
array
$options
=
[])
public
function
__construct
(
$databaseName
,
$collectionName
,
$filter
,
array
$options
=
[])
{
{
...
@@ -185,6 +186,7 @@ class Find implements Executable
...
@@ -185,6 +186,7 @@ class Find implements Executable
* @param Server $server
* @param Server $server
* @return Cursor
* @return Cursor
* @throws UnsupportedException if collation is used and unsupported
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
execute
(
Server
$server
)
public
function
execute
(
Server
$server
)
{
{
...
...
src/Operation/FindAndModify.php
View file @
4fd37901
...
@@ -5,6 +5,7 @@ namespace MongoDB\Operation;
...
@@ -5,6 +5,7 @@ namespace MongoDB\Operation;
use
MongoDB\Driver\Command
;
use
MongoDB\Driver\Command
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Driver\Exception\RuntimeException
as
DriverRuntimeException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\UnexpectedValueException
;
use
MongoDB\Exception\UnexpectedValueException
;
use
MongoDB\Exception\UnsupportedException
;
use
MongoDB\Exception\UnsupportedException
;
...
@@ -73,7 +74,7 @@ class FindAndModify implements Executable
...
@@ -73,7 +74,7 @@ class FindAndModify implements Executable
* @param string $databaseName Database name
* @param string $databaseName Database name
* @param string $collectionName Collection name
* @param string $collectionName Collection name
* @param array $options Command options
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException
for parameter/option parsing errors
*/
*/
public
function
__construct
(
$databaseName
,
$collectionName
,
array
$options
)
public
function
__construct
(
$databaseName
,
$collectionName
,
array
$options
)
{
{
...
@@ -144,6 +145,7 @@ class FindAndModify implements Executable
...
@@ -144,6 +145,7 @@ class FindAndModify implements Executable
* @return object|null
* @return object|null
* @throws UnexpectedValueException if the command response was malformed
* @throws UnexpectedValueException if the command response was malformed
* @throws UnsupportedException if collation is used and unsupported
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
execute
(
Server
$server
)
public
function
execute
(
Server
$server
)
{
{
...
...
src/Operation/FindOne.php
View file @
4fd37901
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
namespace
MongoDB\Operation
;
namespace
MongoDB\Operation
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Exception\RuntimeException
as
DriverRuntimeException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\UnsupportedException
;
use
MongoDB\Exception\UnsupportedException
;
...
@@ -61,7 +62,7 @@ class FindOne implements Executable
...
@@ -61,7 +62,7 @@ class FindOne implements Executable
* @param string $collectionName Collection name
* @param string $collectionName Collection name
* @param array|object $filter Query by which to filter documents
* @param array|object $filter Query by which to filter documents
* @param array $options Command options
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException
for parameter/option parsing errors
*/
*/
public
function
__construct
(
$databaseName
,
$collectionName
,
$filter
,
array
$options
=
[])
public
function
__construct
(
$databaseName
,
$collectionName
,
$filter
,
array
$options
=
[])
{
{
...
@@ -82,6 +83,7 @@ class FindOne implements Executable
...
@@ -82,6 +83,7 @@ class FindOne implements Executable
* @param Server $server
* @param Server $server
* @return array|object|null
* @return array|object|null
* @throws UnsupportedException if collation is used and unsupported
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
execute
(
Server
$server
)
public
function
execute
(
Server
$server
)
{
{
...
...
src/Operation/FindOneAndDelete.php
View file @
4fd37901
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
namespace
MongoDB\Operation
;
namespace
MongoDB\Operation
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Exception\RuntimeException
as
DriverRuntimeException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\UnsupportedException
;
use
MongoDB\Exception\UnsupportedException
;
...
@@ -43,7 +44,7 @@ class FindOneAndDelete implements Executable
...
@@ -43,7 +44,7 @@ class FindOneAndDelete implements Executable
* @param string $collectionName Collection name
* @param string $collectionName Collection name
* @param array|object $filter Query by which to filter documents
* @param array|object $filter Query by which to filter documents
* @param array $options Command options
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException
for parameter/option parsing errors
*/
*/
public
function
__construct
(
$databaseName
,
$collectionName
,
$filter
,
array
$options
=
[])
public
function
__construct
(
$databaseName
,
$collectionName
,
$filter
,
array
$options
=
[])
{
{
...
@@ -75,6 +76,7 @@ class FindOneAndDelete implements Executable
...
@@ -75,6 +76,7 @@ class FindOneAndDelete implements Executable
* @param Server $server
* @param Server $server
* @return object|null
* @return object|null
* @throws UnsupportedException if collation is used and unsupported
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
execute
(
Server
$server
)
public
function
execute
(
Server
$server
)
{
{
...
...
src/Operation/FindOneAndReplace.php
View file @
4fd37901
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
namespace
MongoDB\Operation
;
namespace
MongoDB\Operation
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Exception\RuntimeException
as
DriverRuntimeException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\UnsupportedException
;
use
MongoDB\Exception\UnsupportedException
;
...
@@ -59,7 +60,7 @@ class FindOneAndReplace implements Executable
...
@@ -59,7 +60,7 @@ class FindOneAndReplace implements Executable
* @param array|object $filter Query by which to filter documents
* @param array|object $filter Query by which to filter documents
* @param array|object $replacement Replacement document
* @param array|object $replacement Replacement document
* @param array $options Command options
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException
for parameter/option parsing errors
*/
*/
public
function
__construct
(
$databaseName
,
$collectionName
,
$filter
,
$replacement
,
array
$options
=
[])
public
function
__construct
(
$databaseName
,
$collectionName
,
$filter
,
$replacement
,
array
$options
=
[])
{
{
...
@@ -115,6 +116,7 @@ class FindOneAndReplace implements Executable
...
@@ -115,6 +116,7 @@ class FindOneAndReplace implements Executable
* @param Server $server
* @param Server $server
* @return object|null
* @return object|null
* @throws UnsupportedException if collation is used and unsupported
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
execute
(
Server
$server
)
public
function
execute
(
Server
$server
)
{
{
...
...
src/Operation/FindOneAndUpdate.php
View file @
4fd37901
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
namespace
MongoDB\Operation
;
namespace
MongoDB\Operation
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Exception\RuntimeException
as
DriverRuntimeException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\UnsupportedException
;
use
MongoDB\Exception\UnsupportedException
;
...
@@ -59,7 +60,7 @@ class FindOneAndUpdate implements Executable
...
@@ -59,7 +60,7 @@ class FindOneAndUpdate implements Executable
* @param array|object $filter Query by which to filter documents
* @param array|object $filter Query by which to filter documents
* @param array|object $update Update to apply to the matched document
* @param array|object $update Update to apply to the matched document
* @param array $options Command options
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException
for parameter/option parsing errors
*/
*/
public
function
__construct
(
$databaseName
,
$collectionName
,
$filter
,
$update
,
array
$options
=
[])
public
function
__construct
(
$databaseName
,
$collectionName
,
$filter
,
$update
,
array
$options
=
[])
{
{
...
@@ -115,6 +116,7 @@ class FindOneAndUpdate implements Executable
...
@@ -115,6 +116,7 @@ class FindOneAndUpdate implements Executable
* @param Server $server
* @param Server $server
* @return object|null
* @return object|null
* @throws UnsupportedException if collation is used and unsupported
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
execute
(
Server
$server
)
public
function
execute
(
Server
$server
)
{
{
...
...
src/Operation/InsertMany.php
View file @
4fd37901
...
@@ -6,6 +6,7 @@ use MongoDB\InsertManyResult;
...
@@ -6,6 +6,7 @@ use MongoDB\InsertManyResult;
use
MongoDB\Driver\BulkWrite
as
Bulk
;
use
MongoDB\Driver\BulkWrite
as
Bulk
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Driver\Exception\RuntimeException
as
DriverRuntimeException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
/**
/**
...
@@ -42,7 +43,7 @@ class InsertMany implements Executable
...
@@ -42,7 +43,7 @@ class InsertMany implements Executable
* @param string $collectionName Collection name
* @param string $collectionName Collection name
* @param array[]|object[] $documents List of documents to insert
* @param array[]|object[] $documents List of documents to insert
* @param array $options Command options
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException
for parameter/option parsing errors
*/
*/
public
function
__construct
(
$databaseName
,
$collectionName
,
array
$documents
,
array
$options
=
[])
public
function
__construct
(
$databaseName
,
$collectionName
,
array
$documents
,
array
$options
=
[])
{
{
...
@@ -90,6 +91,7 @@ class InsertMany implements Executable
...
@@ -90,6 +91,7 @@ class InsertMany implements Executable
* @see Executable::execute()
* @see Executable::execute()
* @param Server $server
* @param Server $server
* @return InsertManyResult
* @return InsertManyResult
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
execute
(
Server
$server
)
public
function
execute
(
Server
$server
)
{
{
...
...
src/Operation/InsertOne.php
View file @
4fd37901
...
@@ -6,6 +6,7 @@ use MongoDB\InsertOneResult;
...
@@ -6,6 +6,7 @@ use MongoDB\InsertOneResult;
use
MongoDB\Driver\BulkWrite
as
Bulk
;
use
MongoDB\Driver\BulkWrite
as
Bulk
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Driver\Exception\RuntimeException
as
DriverRuntimeException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
/**
/**
...
@@ -38,7 +39,7 @@ class InsertOne implements Executable
...
@@ -38,7 +39,7 @@ class InsertOne implements Executable
* @param string $collectionName Collection name
* @param string $collectionName Collection name
* @param array|object $document Document to insert
* @param array|object $document Document to insert
* @param array $options Command options
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException
for parameter/option parsing errors
*/
*/
public
function
__construct
(
$databaseName
,
$collectionName
,
$document
,
array
$options
=
[])
public
function
__construct
(
$databaseName
,
$collectionName
,
$document
,
array
$options
=
[])
{
{
...
@@ -66,6 +67,7 @@ class InsertOne implements Executable
...
@@ -66,6 +67,7 @@ class InsertOne implements Executable
* @see Executable::execute()
* @see Executable::execute()
* @param Server $server
* @param Server $server
* @return InsertOneResult
* @return InsertOneResult
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
execute
(
Server
$server
)
public
function
execute
(
Server
$server
)
{
{
...
...
src/Operation/ListCollections.php
View file @
4fd37901
...
@@ -5,6 +5,7 @@ namespace MongoDB\Operation;
...
@@ -5,6 +5,7 @@ namespace MongoDB\Operation;
use
MongoDB\Driver\Command
;
use
MongoDB\Driver\Command
;
use
MongoDB\Driver\Query
;
use
MongoDB\Driver\Query
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Exception\RuntimeException
as
DriverRuntimeException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Model\CollectionInfoCommandIterator
;
use
MongoDB\Model\CollectionInfoCommandIterator
;
use
MongoDB\Model\CollectionInfoIterator
;
use
MongoDB\Model\CollectionInfoIterator
;
...
@@ -36,7 +37,7 @@ class ListCollections implements Executable
...
@@ -36,7 +37,7 @@ class ListCollections implements Executable
*
*
* @param string $databaseName Database name
* @param string $databaseName Database name
* @param array $options Command options
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException
for parameter/option parsing errors
*/
*/
public
function
__construct
(
$databaseName
,
array
$options
=
[])
public
function
__construct
(
$databaseName
,
array
$options
=
[])
{
{
...
@@ -58,6 +59,8 @@ class ListCollections implements Executable
...
@@ -58,6 +59,8 @@ class ListCollections implements Executable
* @see Executable::execute()
* @see Executable::execute()
* @param Server $server
* @param Server $server
* @return CollectionInfoIterator
* @return CollectionInfoIterator
* @throws InvalidArgumentException if filter.name is not a string for legacy execution
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
execute
(
Server
$server
)
public
function
execute
(
Server
$server
)
{
{
...
@@ -72,6 +75,7 @@ class ListCollections implements Executable
...
@@ -72,6 +75,7 @@ class ListCollections implements Executable
*
*
* @param Server $server
* @param Server $server
* @return CollectionInfoCommandIterator
* @return CollectionInfoCommandIterator
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
private
function
executeCommand
(
Server
$server
)
private
function
executeCommand
(
Server
$server
)
{
{
...
@@ -97,7 +101,8 @@ class ListCollections implements Executable
...
@@ -97,7 +101,8 @@ class ListCollections implements Executable
*
*
* @param Server $server
* @param Server $server
* @return CollectionInfoLegacyIterator
* @return CollectionInfoLegacyIterator
* @throws InvalidArgumentException if filter.name is not a string.
* @throws InvalidArgumentException if filter.name is not a string
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
private
function
executeLegacy
(
Server
$server
)
private
function
executeLegacy
(
Server
$server
)
{
{
...
...
src/Operation/ListDatabases.php
View file @
4fd37901
...
@@ -4,6 +4,7 @@ namespace MongoDB\Operation;
...
@@ -4,6 +4,7 @@ namespace MongoDB\Operation;
use
MongoDB\Driver\Command
;
use
MongoDB\Driver\Command
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Exception\RuntimeException
as
DriverRuntimeException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\UnexpectedValueException
;
use
MongoDB\Exception\UnexpectedValueException
;
use
MongoDB\Model\DatabaseInfoIterator
;
use
MongoDB\Model\DatabaseInfoIterator
;
...
@@ -29,7 +30,7 @@ class ListDatabases implements Executable
...
@@ -29,7 +30,7 @@ class ListDatabases implements Executable
* run.
* run.
*
*
* @param array $options Command options
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException
for parameter/option parsing errors
*/
*/
public
function
__construct
(
array
$options
=
[])
public
function
__construct
(
array
$options
=
[])
{
{
...
@@ -47,6 +48,7 @@ class ListDatabases implements Executable
...
@@ -47,6 +48,7 @@ class ListDatabases implements Executable
* @param Server $server
* @param Server $server
* @return DatabaseInfoIterator
* @return DatabaseInfoIterator
* @throws UnexpectedValueException if the command response was malformed
* @throws UnexpectedValueException if the command response was malformed
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
execute
(
Server
$server
)
public
function
execute
(
Server
$server
)
{
{
...
...
src/Operation/ListIndexes.php
View file @
4fd37901
...
@@ -5,7 +5,7 @@ namespace MongoDB\Operation;
...
@@ -5,7 +5,7 @@ namespace MongoDB\Operation;
use
MongoDB\Driver\Command
;
use
MongoDB\Driver\Command
;
use
MongoDB\Driver\Query
;
use
MongoDB\Driver\Query
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Exception\RuntimeException
;
use
MongoDB\Driver\Exception\RuntimeException
as
DriverRuntimeException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Model\IndexInfoIterator
;
use
MongoDB\Model\IndexInfoIterator
;
use
MongoDB\Model\IndexInfoIteratorIterator
;
use
MongoDB\Model\IndexInfoIteratorIterator
;
...
@@ -39,7 +39,7 @@ class ListIndexes implements Executable
...
@@ -39,7 +39,7 @@ class ListIndexes implements Executable
* @param string $databaseName Database name
* @param string $databaseName Database name
* @param string $collectionName Collection name
* @param string $collectionName Collection name
* @param array $options Command options
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException
for parameter/option parsing errors
*/
*/
public
function
__construct
(
$databaseName
,
$collectionName
,
array
$options
=
[])
public
function
__construct
(
$databaseName
,
$collectionName
,
array
$options
=
[])
{
{
...
@@ -58,6 +58,7 @@ class ListIndexes implements Executable
...
@@ -58,6 +58,7 @@ class ListIndexes implements Executable
* @see Executable::execute()
* @see Executable::execute()
* @param Server $server
* @param Server $server
* @return IndexInfoIterator
* @return IndexInfoIterator
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
execute
(
Server
$server
)
public
function
execute
(
Server
$server
)
{
{
...
@@ -72,6 +73,7 @@ class ListIndexes implements Executable
...
@@ -72,6 +73,7 @@ class ListIndexes implements Executable
*
*
* @param Server $server
* @param Server $server
* @return IndexInfoIteratorIterator
* @return IndexInfoIteratorIterator
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
private
function
executeCommand
(
Server
$server
)
private
function
executeCommand
(
Server
$server
)
{
{
...
@@ -83,7 +85,7 @@ class ListIndexes implements Executable
...
@@ -83,7 +85,7 @@ class ListIndexes implements Executable
try
{
try
{
$cursor
=
$server
->
executeCommand
(
$this
->
databaseName
,
new
Command
(
$cmd
));
$cursor
=
$server
->
executeCommand
(
$this
->
databaseName
,
new
Command
(
$cmd
));
}
catch
(
RuntimeException
$e
)
{
}
catch
(
Driver
RuntimeException
$e
)
{
/* The server may return an error if the collection does not exist.
/* The server may return an error if the collection does not exist.
* Check for possible error codes (see: SERVER-20463) and return an
* Check for possible error codes (see: SERVER-20463) and return an
* empty iterator instead of throwing.
* empty iterator instead of throwing.
...
@@ -106,6 +108,7 @@ class ListIndexes implements Executable
...
@@ -106,6 +108,7 @@ class ListIndexes implements Executable
*
*
* @param Server $server
* @param Server $server
* @return IndexInfoIteratorIterator
* @return IndexInfoIteratorIterator
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
private
function
executeLegacy
(
Server
$server
)
private
function
executeLegacy
(
Server
$server
)
{
{
...
...
src/Operation/ReplaceOne.php
View file @
4fd37901
...
@@ -4,6 +4,7 @@ namespace MongoDB\Operation;
...
@@ -4,6 +4,7 @@ namespace MongoDB\Operation;
use
MongoDB\UpdateResult
;
use
MongoDB\UpdateResult
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Exception\RuntimeException
as
DriverRuntimeException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\UnsupportedException
;
use
MongoDB\Exception\UnsupportedException
;
...
@@ -41,7 +42,7 @@ class ReplaceOne implements Executable
...
@@ -41,7 +42,7 @@ class ReplaceOne implements Executable
* @param array|object $filter Query by which to filter documents
* @param array|object $filter Query by which to filter documents
* @param array|object $replacement Replacement document
* @param array|object $replacement Replacement document
* @param array $options Command options
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException
for parameter/option parsing errors
*/
*/
public
function
__construct
(
$databaseName
,
$collectionName
,
$filter
,
$replacement
,
array
$options
=
[])
public
function
__construct
(
$databaseName
,
$collectionName
,
$filter
,
$replacement
,
array
$options
=
[])
{
{
...
@@ -69,6 +70,7 @@ class ReplaceOne implements Executable
...
@@ -69,6 +70,7 @@ class ReplaceOne implements Executable
* @param Server $server
* @param Server $server
* @return UpdateResult
* @return UpdateResult
* @throws UnsupportedException if collation is used and unsupported
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
execute
(
Server
$server
)
public
function
execute
(
Server
$server
)
{
{
...
...
src/Operation/Update.php
View file @
4fd37901
...
@@ -6,6 +6,7 @@ use MongoDB\UpdateResult;
...
@@ -6,6 +6,7 @@ use MongoDB\UpdateResult;
use
MongoDB\Driver\BulkWrite
as
Bulk
;
use
MongoDB\Driver\BulkWrite
as
Bulk
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Driver\WriteConcern
;
use
MongoDB\Driver\Exception\RuntimeException
as
DriverRuntimeException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\UnsupportedException
;
use
MongoDB\Exception\UnsupportedException
;
...
@@ -57,7 +58,7 @@ class Update implements Executable
...
@@ -57,7 +58,7 @@ class Update implements Executable
* @param array|object $update Update to apply to the matched
* @param array|object $update Update to apply to the matched
* document(s) or a replacement document
* document(s) or a replacement document
* @param array $options Command options
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException
for parameter/option parsing errors
*/
*/
public
function
__construct
(
$databaseName
,
$collectionName
,
$filter
,
$update
,
array
$options
=
[])
public
function
__construct
(
$databaseName
,
$collectionName
,
$filter
,
$update
,
array
$options
=
[])
{
{
...
@@ -112,6 +113,7 @@ class Update implements Executable
...
@@ -112,6 +113,7 @@ class Update implements Executable
* @param Server $server
* @param Server $server
* @return UpdateResult
* @return UpdateResult
* @throws UnsupportedException if collation is used and unsupported
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
execute
(
Server
$server
)
public
function
execute
(
Server
$server
)
{
{
...
...
src/Operation/UpdateMany.php
View file @
4fd37901
...
@@ -4,6 +4,7 @@ namespace MongoDB\Operation;
...
@@ -4,6 +4,7 @@ namespace MongoDB\Operation;
use
MongoDB\UpdateResult
;
use
MongoDB\UpdateResult
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Exception\RuntimeException
as
DriverRuntimeException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\UnsupportedException
;
use
MongoDB\Exception\UnsupportedException
;
...
@@ -41,7 +42,7 @@ class UpdateMany implements Executable
...
@@ -41,7 +42,7 @@ class UpdateMany implements Executable
* @param array|object $filter Query by which to filter documents
* @param array|object $filter Query by which to filter documents
* @param array|object $update Update to apply to the matched documents
* @param array|object $update Update to apply to the matched documents
* @param array $options Command options
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException
for parameter/option parsing errors
*/
*/
public
function
__construct
(
$databaseName
,
$collectionName
,
$filter
,
$update
,
array
$options
=
[])
public
function
__construct
(
$databaseName
,
$collectionName
,
$filter
,
$update
,
array
$options
=
[])
{
{
...
@@ -69,6 +70,7 @@ class UpdateMany implements Executable
...
@@ -69,6 +70,7 @@ class UpdateMany implements Executable
* @param Server $server
* @param Server $server
* @return UpdateResult
* @return UpdateResult
* @throws UnsupportedException if collation is used and unsupported
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
execute
(
Server
$server
)
public
function
execute
(
Server
$server
)
{
{
...
...
src/Operation/UpdateOne.php
View file @
4fd37901
...
@@ -4,6 +4,7 @@ namespace MongoDB\Operation;
...
@@ -4,6 +4,7 @@ namespace MongoDB\Operation;
use
MongoDB\UpdateResult
;
use
MongoDB\UpdateResult
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Server
;
use
MongoDB\Driver\Exception\RuntimeException
as
DriverRuntimeException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\InvalidArgumentException
;
use
MongoDB\Exception\UnsupportedException
;
use
MongoDB\Exception\UnsupportedException
;
...
@@ -41,7 +42,7 @@ class UpdateOne implements Executable
...
@@ -41,7 +42,7 @@ class UpdateOne implements Executable
* @param array|object $filter Query by which to filter documents
* @param array|object $filter Query by which to filter documents
* @param array|object $update Update to apply to the matched document
* @param array|object $update Update to apply to the matched document
* @param array $options Command options
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException
for parameter/option parsing errors
*/
*/
public
function
__construct
(
$databaseName
,
$collectionName
,
$filter
,
$update
,
array
$options
=
[])
public
function
__construct
(
$databaseName
,
$collectionName
,
$filter
,
$update
,
array
$options
=
[])
{
{
...
@@ -69,6 +70,7 @@ class UpdateOne implements Executable
...
@@ -69,6 +70,7 @@ class UpdateOne implements Executable
* @param Server $server
* @param Server $server
* @return UpdateResult
* @return UpdateResult
* @throws UnsupportedException if collation is used and unsupported
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
*/
public
function
execute
(
Server
$server
)
public
function
execute
(
Server
$server
)
{
{
...
...
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