Commit 4fd37901 authored by Jeremy Mikola's avatar Jeremy Mikola

PHPLIB-234: Document exceptions for API methods

parent 3cc57327
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``).
...
......@@ -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
``typeMap`` option.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unsupportedexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Example
-------
......
......@@ -36,6 +36,13 @@ A traversable :phpclass:`MongoDB\\Model\\DatabaseInfoIterator`, which contains
a :phpclass:`MongoDB\\Model\\DatabaseInfo` object for each database on the
server.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unexpectedvalueexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Example
-------
......
......@@ -34,6 +34,11 @@ Return Values
A :phpclass:`MongoDB\\Collection` object.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-invalidargumentexception.rst
Behavior
--------
......
......@@ -34,6 +34,11 @@ Return Values
A :phpclass:`MongoDB\\Database` object.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-invalidargumentexception.rst
Behavior
--------
......
......@@ -29,6 +29,13 @@ Definition
.. 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
--------
......
......@@ -37,6 +37,14 @@ A :php:`MongoDB\\Driver\\Cursor <class.mongodb-driver-cursor>` or
:php:`ArrayIterator <arrayiterator>` object. In both cases, the return value
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:
Behavior
......
......@@ -35,6 +35,13 @@ Return Values
A :phpclass:`MongoDB\\BulkWriteResult` object, which encapsulates a
: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
See Also
......
......@@ -34,6 +34,14 @@ Return Values
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
See Also
......
......@@ -39,6 +39,13 @@ Return Values
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
--------
......
......@@ -34,6 +34,13 @@ Return Values
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
----------------------
......
......@@ -35,6 +35,13 @@ Return Values
A :phpclass:`MongoDB\\DeleteResult` object, which encapsulates a
: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
-------
......
......@@ -37,6 +37,13 @@ Return Values
A :phpclass:`MongoDB\\DeleteResult` object, which encapsulates a
: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
-------
......
......@@ -34,6 +34,14 @@ Return 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
--------
......
......@@ -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
``typeMap`` option.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unsupportedexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Example
-------
......
......@@ -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
``typeMap`` option.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unsupportedexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Example
-------
......
......@@ -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
``typeMap`` option.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unsupportedexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Example
-------
......
......@@ -34,6 +34,13 @@ Return Values
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
--------
......
......@@ -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
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
--------
......
......@@ -37,6 +37,14 @@ Return Values
An object for the document that was deleted, or ``null`` if no document matched
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
--------
......
......@@ -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
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
--------
......
......@@ -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
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
--------
......
......@@ -35,6 +35,12 @@ Return Values
A :phpclass:`MongoDB\\InsertManyResult` object, which encapsulates a
: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
-------
......
......@@ -35,6 +35,12 @@ Return Values
A :phpclass:`MongoDB\\InsertOneResult` object, which encapsulates a
: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
-------
......
......@@ -35,6 +35,12 @@ Return Values
A traversable :phpclass:`MongoDB\\Model\\IndexInfoIterator`, which contains a
: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
-------
......
......@@ -37,6 +37,13 @@ Return Values
A :phpclass:`MongoDB\\UpdateResult` object, which encapsulates a
: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
-------
......
......@@ -35,6 +35,13 @@ Return Values
A :phpclass:`MongoDB\\UpdateResult` object, which encapsulates a
: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
--------
......
......@@ -37,6 +37,13 @@ Return Values
A :phpclass:`MongoDB\\UpdateResult` object, which encapsulates a
: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
--------
......
......@@ -34,6 +34,11 @@ Return Values
A :phpclass:`MongoDB\\Collection` object.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-invalidargumentexception.rst
Example
-------
......
......@@ -29,6 +29,11 @@ Definition
.. include:: /includes/apiargs/MongoDBCollection-method-construct-option.rst
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-invalidargumentexception.rst
Behavior
--------
......
......@@ -34,6 +34,12 @@ Return Values
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
-------
......
......@@ -53,6 +53,13 @@ Return Values
An array or object with the result document of the :manual:`create
</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
-------
......
......@@ -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
``typeMap`` option.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unsupportedexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Example
-------
......
......@@ -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
``typeMap`` option.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-unsupportedexception.rst
.. include:: /includes/extracts/error-invalidargumentexception.rst
.. include:: /includes/extracts/error-driver-runtimeexception.rst
Example
-------
......
......@@ -34,6 +34,11 @@ Return Values
A :phpclass:`MongoDB\\Collection` object.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-invalidargumentexception.rst
Behavior
--------
......
......@@ -34,6 +34,11 @@ Return Values
A :phpclass:`MongoDB\\GridFS\\Bucket` object.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-invalidargumentexception.rst
Behavior
--------
......
......@@ -34,6 +34,11 @@ Return Values
A :phpclass:`MongoDB\\Database` object.
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-invalidargumentexception.rst
Example
-------
......
......@@ -29,6 +29,11 @@ Definition
.. include:: /includes/apiargs/MongoDBDatabase-method-construct-option.rst
Errors/Exceptions
-----------------
.. include:: /includes/extracts/error-invalidargumentexception.rst
Behavior
--------
......
......@@ -4,7 +4,11 @@ namespace MongoDB;
use MongoDB\Driver\Manager;
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\UnexpectedValueException;
use MongoDB\Exception\UnsupportedException;
use MongoDB\Model\DatabaseInfoIterator;
use MongoDB\Operation\DropDatabase;
use MongoDB\Operation\ListDatabases;
......@@ -41,7 +45,9 @@ class Client
* @param string $uri MongoDB connection string
* @param array $uriOptions Additional connection string 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 = [])
{
......@@ -108,6 +114,9 @@ class Client
* @param string $databaseName Database name
* @param array $options Additional options
* @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 = [])
{
......@@ -141,6 +150,9 @@ class Client
*
* @see ListDatabases::__construct() for supported options
* @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 = [])
{
......@@ -158,6 +170,7 @@ class Client
* @param string $collectionName Name of the collection to select
* @param array $options Collection constructor options
* @return Collection
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function selectCollection($databaseName, $collectionName, array $options = [])
{
......@@ -173,6 +186,7 @@ class Client
* @param string $databaseName Name of the database to select
* @param array $options Database constructor options
* @return Database
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function selectDatabase($databaseName, array $options = [])
{
......
......@@ -7,7 +7,10 @@ use MongoDB\Driver\Manager;
use MongoDB\Driver\ReadConcern;
use MongoDB\Driver\ReadPreference;
use MongoDB\Driver\WriteConcern;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Exception\UnexpectedValueException;
use MongoDB\Exception\UnsupportedException;
use MongoDB\Model\IndexInfoIterator;
use MongoDB\Operation\Aggregate;
use MongoDB\Operation\BulkWrite;
......@@ -74,7 +77,7 @@ class Collection
* @param string $databaseName Database name
* @param string $collectionName Collection name
* @param array $options Collection options
* @throws InvalidArgumentException
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function __construct(Manager $manager, $databaseName, $collectionName, array $options = [])
{
......@@ -157,6 +160,10 @@ class Collection
* @param array $pipeline List of pipeline operations
* @param array $options Command options
* @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 = [])
{
......@@ -199,6 +206,9 @@ class Collection
* @param array[] $operations List of write operations
* @param array $options Command options
* @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 = [])
{
......@@ -219,6 +229,10 @@ class Collection
* @param array|object $filter Query by which to filter documents
* @param array $options Command options
* @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 = [])
{
......@@ -245,6 +259,9 @@ class Collection
* which denote order or an index type
* @param array $options Index options
* @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 = [])
{
......@@ -277,7 +294,9 @@ class Collection
* @param array[] $indexes List of index specifications
* @param array $options Command options
* @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 = [])
{
......@@ -300,6 +319,9 @@ class Collection
* @param array|object $filter Query by which to delete documents
* @param array $options Command options
* @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 = [])
{
......@@ -321,6 +343,9 @@ class Collection
* @param array|object $filter Query by which to delete documents
* @param array $options Command options
* @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 = [])
{
......@@ -342,6 +367,10 @@ class Collection
* @param array|object $filter Query by which to filter documents
* @param array $options Command options
* @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 = [])
{
......@@ -365,6 +394,9 @@ class Collection
* @see DropCollection::__construct() for supported options
* @param array $options Additional options
* @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 = [])
{
......@@ -390,7 +422,9 @@ class Collection
* @param string $indexName Index name
* @param array $options Additional options
* @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 = [])
{
......@@ -421,6 +455,9 @@ class Collection
* @see DropIndexes::__construct() for supported options
* @param array $options Additional options
* @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 = [])
{
......@@ -447,6 +484,9 @@ class Collection
* @param array|object $filter Query by which to filter documents
* @param array $options Additional options
* @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 = [])
{
......@@ -476,6 +516,9 @@ class Collection
* @param array|object $filter Query by which to filter documents
* @param array $options Additional options
* @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 = [])
{
......@@ -510,6 +553,10 @@ class Collection
* @param array|object $filter Query by which to filter documents
* @param array $options Command options
* @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 = [])
{
......@@ -542,6 +589,10 @@ class Collection
* @param array|object $replacement Replacement document
* @param array $options Command options
* @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 = [])
{
......@@ -574,6 +625,10 @@ class Collection
* @param array|object $update Update to apply to the matched document
* @param array $options Command options
* @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 = [])
{
......@@ -637,6 +692,8 @@ class Collection
* @param array[]|object[] $documents The documents to insert
* @param array $options Command options
* @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 = [])
{
......@@ -658,6 +715,8 @@ class Collection
* @param array|object $document The document to insert
* @param array $options Command options
* @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 = [])
{
......@@ -676,6 +735,8 @@ class Collection
*
* @see ListIndexes::__construct() for supported options
* @return IndexInfoIterator
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
public function listIndexes(array $options = [])
{
......@@ -694,6 +755,9 @@ class Collection
* @param array|object $replacement Replacement document
* @param array $options Command options
* @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 = [])
{
......@@ -716,6 +780,9 @@ class Collection
* @param array|object $update Update to apply to the matched documents
* @param array $options Command options
* @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 = [])
{
......@@ -738,6 +805,9 @@ class Collection
* @param array|object $update Update to apply to the matched document
* @param array $options Command options
* @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 = [])
{
......@@ -757,6 +827,7 @@ class Collection
* @see Collection::__construct() for supported options
* @param array $options Collection constructor options
* @return Collection
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function withOptions(array $options = [])
{
......
......@@ -8,7 +8,9 @@ use MongoDB\Driver\Manager;
use MongoDB\Driver\ReadConcern;
use MongoDB\Driver\ReadPreference;
use MongoDB\Driver\WriteConcern;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Exception\UnsupportedException;
use MongoDB\GridFS\Bucket;
use MongoDB\Model\CollectionInfoIterator;
use MongoDB\Operation\CreateCollection;
......@@ -58,7 +60,7 @@ class Database
* @param Manager $manager Manager instance from the driver
* @param string $databaseName Database name
* @param array $options Database options
* @throws InvalidArgumentException
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function __construct(Manager $manager, $databaseName, array $options = [])
{
......@@ -142,7 +144,8 @@ class Database
* @param array|object $command Command document
* @param array $options Options for command execution
* @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 = [])
{
......@@ -167,6 +170,9 @@ class Database
* @param string $collectionName
* @param array $options
* @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 = [])
{
......@@ -191,6 +197,9 @@ class Database
* @see DropDatabase::__construct() for supported options
* @param array $options Additional options
* @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 = [])
{
......@@ -216,6 +225,9 @@ class Database
* @param string $collectionName Collection name
* @param array $options Additional options
* @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 = [])
{
......@@ -260,6 +272,8 @@ class Database
* @see ListCollections::__construct() for supported options
* @param array $options
* @return CollectionInfoIterator
* @throws InvalidArgumentException for parameter/option parsing errors
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
public function listCollections(array $options = [])
{
......@@ -276,6 +290,7 @@ class Database
* @param string $collectionName Name of the collection to select
* @param array $options Collection constructor options
* @return Collection
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function selectCollection($collectionName, array $options = [])
{
......@@ -295,6 +310,7 @@ class Database
* @see Bucket::__construct() for supported options
* @param array $options Bucket constructor options
* @return Bucket
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function selectGridFSBucket(array $options = [])
{
......@@ -313,6 +329,7 @@ class Database
* @see Database::__construct() for supported options
* @param array $options Database constructor options
* @return Database
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function withOptions(array $options = [])
{
......
......@@ -7,6 +7,7 @@ use MongoDB\Driver\ReadConcern;
use MongoDB\Driver\ReadPreference;
use MongoDB\Driver\Server;
use MongoDB\Driver\WriteConcern;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Exception\UnexpectedValueException;
use MongoDB\Exception\UnsupportedException;
......@@ -93,7 +94,7 @@ class Aggregate implements Executable
* @param string $collectionName Collection name
* @param array $pipeline List of pipeline operations
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function __construct($databaseName, $collectionName, array $pipeline, array $options = [])
{
......@@ -182,6 +183,7 @@ class Aggregate implements Executable
* @return Traversable
* @throws UnexpectedValueException if the command response was malformed
* @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)
{
......
......@@ -6,6 +6,7 @@ use MongoDB\BulkWriteResult;
use MongoDB\Driver\BulkWrite as Bulk;
use MongoDB\Driver\Server;
use MongoDB\Driver\WriteConcern;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Exception\UnsupportedException;
......@@ -83,7 +84,7 @@ class BulkWrite implements Executable
* @param string $collectionName Collection name
* @param array[] $operations List of write operations
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function __construct($databaseName, $collectionName, array $operations, array $options = [])
{
......@@ -260,6 +261,7 @@ class BulkWrite implements Executable
* @param Server $server
* @return BulkWriteResult
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
public function execute(Server $server)
{
......
......@@ -6,6 +6,7 @@ use MongoDB\Driver\Command;
use MongoDB\Driver\ReadConcern;
use MongoDB\Driver\ReadPreference;
use MongoDB\Driver\Server;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Exception\UnexpectedValueException;
use MongoDB\Exception\UnsupportedException;
......@@ -59,7 +60,7 @@ class Count implements Executable
* @param string $collectionName Collection name
* @param array|object $filter Query by which to filter documents
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function __construct($databaseName, $collectionName, $filter = [], array $options = [])
{
......@@ -115,6 +116,7 @@ class Count implements Executable
* @return integer
* @throws UnexpectedValueException if the command response was malformed
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
public function execute(Server $server)
{
......
......@@ -5,6 +5,7 @@ namespace MongoDB\Operation;
use MongoDB\Driver\Command;
use MongoDB\Driver\Server;
use MongoDB\Driver\WriteConcern;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Exception\UnsupportedException;
......@@ -81,7 +82,7 @@ class CreateCollection implements Executable
* @param string $databaseName Database name
* @param string $collectionName Collection name
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function __construct($databaseName, $collectionName, array $options = [])
{
......@@ -153,6 +154,7 @@ class CreateCollection implements Executable
* @param Server $server
* @return array|object Command result document
* @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)
{
......
......@@ -6,6 +6,7 @@ use MongoDB\Driver\Command;
use MongoDB\Driver\Server;
use MongoDB\Driver\BulkWrite as Bulk;
use MongoDB\Driver\WriteConcern;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Exception\UnsupportedException;
use MongoDB\Model\IndexInput;
......@@ -44,7 +45,7 @@ class CreateIndexes implements Executable
* @param string $collectionName Collection name
* @param array[] $indexes List of index specifications
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function __construct($databaseName, $collectionName, array $indexes, array $options = [])
{
......@@ -95,6 +96,7 @@ class CreateIndexes implements Executable
* @param Server $server
* @return string[] The names of the created indexes
* @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)
{
......@@ -120,6 +122,7 @@ class CreateIndexes implements Executable
* command.
*
* @param Server $server
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
private function executeCommand(Server $server)
{
......@@ -140,6 +143,7 @@ class CreateIndexes implements Executable
* "system.indexes" collection (MongoDB <2.6).
*
* @param Server $server
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
private function executeLegacy(Server $server)
{
......
......@@ -6,6 +6,7 @@ use MongoDB\Driver\Command;
use MongoDB\Driver\Cursor;
use MongoDB\Driver\ReadPreference;
use MongoDB\Driver\Server;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException;
/**
......@@ -37,7 +38,7 @@ class DatabaseCommand implements Executable
* @param string $databaseName Database name
* @param array|object $command Command document
* @param array $options Options for command execution
* @throws InvalidArgumentException
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function __construct($databaseName, $command, array $options = [])
{
......
......@@ -6,6 +6,7 @@ use MongoDB\DeleteResult;
use MongoDB\Driver\BulkWrite as Bulk;
use MongoDB\Driver\Server;
use MongoDB\Driver\WriteConcern;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Exception\UnsupportedException;
......@@ -47,7 +48,7 @@ class Delete implements Executable
* delete. Must be 0 or 1, for all or a
* single document, respectively.
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function __construct($databaseName, $collectionName, $filter, $limit, array $options = [])
{
......@@ -80,6 +81,7 @@ class Delete implements Executable
* @see Executable::execute()
* @param Server $server
* @return DeleteResult
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
public function execute(Server $server)
{
......
......@@ -4,6 +4,7 @@ namespace MongoDB\Operation;
use MongoDB\DeleteResult;
use MongoDB\Driver\Server;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Exception\UnsupportedException;
......@@ -34,7 +35,7 @@ class DeleteMany implements Executable
* @param string $collectionName Collection name
* @param array|object $filter Query by which to delete documents
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function __construct($databaseName, $collectionName, $filter, array $options = [])
{
......@@ -48,6 +49,7 @@ class DeleteMany implements Executable
* @param Server $server
* @return DeleteResult
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
public function execute(Server $server)
{
......
......@@ -4,6 +4,7 @@ namespace MongoDB\Operation;
use MongoDB\DeleteResult;
use MongoDB\Driver\Server;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Exception\UnsupportedException;
......@@ -34,7 +35,7 @@ class DeleteOne implements Executable
* @param string $collectionName Collection name
* @param array|object $filter Query by which to delete documents
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function __construct($databaseName, $collectionName, $filter, array $options = [])
{
......@@ -48,6 +49,7 @@ class DeleteOne implements Executable
* @param Server $server
* @return DeleteResult
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
public function execute(Server $server)
{
......
......@@ -6,6 +6,7 @@ use MongoDB\Driver\Command;
use MongoDB\Driver\ReadConcern;
use MongoDB\Driver\ReadPreference;
use MongoDB\Driver\Server;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Exception\UnexpectedValueException;
use MongoDB\Exception\UnsupportedException;
......@@ -53,7 +54,7 @@ class Distinct implements Executable
* @param string $fieldName Field for which to return distinct values
* @param array|object $filter Query by which to filter documents
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function __construct($databaseName, $collectionName, $fieldName, $filter = [], array $options = [])
{
......@@ -92,6 +93,7 @@ class Distinct implements Executable
* @return mixed[]
* @throws UnexpectedValueException if the command response was malformed
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
public function execute(Server $server)
{
......
......@@ -5,7 +5,7 @@ namespace MongoDB\Operation;
use MongoDB\Driver\Command;
use MongoDB\Driver\Server;
use MongoDB\Driver\WriteConcern;
use MongoDB\Driver\Exception\RuntimeException;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Exception\UnsupportedException;
......@@ -42,6 +42,7 @@ class DropCollection implements Executable
* @param string $databaseName Database name
* @param string $collectionName Collection name
* @param array $options Command options
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function __construct($databaseName, $collectionName, array $options = [])
{
......@@ -65,6 +66,7 @@ class DropCollection implements Executable
* @param Server $server
* @return array|object Command result document
* @throws UnsupportedException if writeConcern is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
public function execute(Server $server)
{
......@@ -74,7 +76,7 @@ class DropCollection implements Executable
try {
$cursor = $server->executeCommand($this->databaseName, $this->createCommand());
} catch (RuntimeException $e) {
} catch (DriverRuntimeException $e) {
/* The server may return an error if the collection does not exist.
* Check for an error message (unfortunately, there isn't a code)
* and NOP instead of throwing.
......
......@@ -5,6 +5,7 @@ namespace MongoDB\Operation;
use MongoDB\Driver\Command;
use MongoDB\Driver\Server;
use MongoDB\Driver\WriteConcern;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Exception\UnsupportedException;
......@@ -38,6 +39,7 @@ class DropDatabase implements Executable
*
* @param string $databaseName Database name
* @param array $options Command options
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function __construct($databaseName, array $options = [])
{
......@@ -60,6 +62,7 @@ class DropDatabase implements Executable
* @param Server $server
* @return array|object Command result document
* @throws UnsupportedException if writeConcern is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
public function execute(Server $server)
{
......
......@@ -5,6 +5,7 @@ namespace MongoDB\Operation;
use MongoDB\Driver\Command;
use MongoDB\Driver\Server;
use MongoDB\Driver\WriteConcern;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Exception\UnsupportedException;
......@@ -41,7 +42,7 @@ class DropIndexes implements Executable
* @param string $collectionName Collection name
* @param string $indexName Index name (use "*" to drop all indexes)
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function __construct($databaseName, $collectionName, $indexName, array $options = [])
{
......@@ -72,6 +73,7 @@ class DropIndexes implements Executable
* @param Server $server
* @return array|object Command result document
* @throws UnsupportedException if writeConcern is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
public function execute(Server $server)
{
......
......@@ -7,6 +7,7 @@ use MongoDB\Driver\Query;
use MongoDB\Driver\ReadConcern;
use MongoDB\Driver\ReadPreference;
use MongoDB\Driver\Server;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Exception\UnsupportedException;
......@@ -92,7 +93,7 @@ class Find implements Executable
* @param string $collectionName Collection name
* @param array|object $filter Query by which to filter documents
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function __construct($databaseName, $collectionName, $filter, array $options = [])
{
......@@ -185,6 +186,7 @@ class Find implements Executable
* @param Server $server
* @return Cursor
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
public function execute(Server $server)
{
......
......@@ -5,6 +5,7 @@ namespace MongoDB\Operation;
use MongoDB\Driver\Command;
use MongoDB\Driver\Server;
use MongoDB\Driver\WriteConcern;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Exception\UnexpectedValueException;
use MongoDB\Exception\UnsupportedException;
......@@ -73,7 +74,7 @@ class FindAndModify implements Executable
* @param string $databaseName Database name
* @param string $collectionName Collection name
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function __construct($databaseName, $collectionName, array $options)
{
......@@ -144,6 +145,7 @@ class FindAndModify implements Executable
* @return object|null
* @throws UnexpectedValueException if the command response was malformed
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
public function execute(Server $server)
{
......
......@@ -3,6 +3,7 @@
namespace MongoDB\Operation;
use MongoDB\Driver\Server;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Exception\UnsupportedException;
......@@ -61,7 +62,7 @@ class FindOne implements Executable
* @param string $collectionName Collection name
* @param array|object $filter Query by which to filter documents
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function __construct($databaseName, $collectionName, $filter, array $options = [])
{
......@@ -82,6 +83,7 @@ class FindOne implements Executable
* @param Server $server
* @return array|object|null
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
public function execute(Server $server)
{
......
......@@ -3,6 +3,7 @@
namespace MongoDB\Operation;
use MongoDB\Driver\Server;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Exception\UnsupportedException;
......@@ -43,7 +44,7 @@ class FindOneAndDelete implements Executable
* @param string $collectionName Collection name
* @param array|object $filter Query by which to filter documents
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function __construct($databaseName, $collectionName, $filter, array $options = [])
{
......@@ -75,6 +76,7 @@ class FindOneAndDelete implements Executable
* @param Server $server
* @return object|null
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
public function execute(Server $server)
{
......
......@@ -3,6 +3,7 @@
namespace MongoDB\Operation;
use MongoDB\Driver\Server;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Exception\UnsupportedException;
......@@ -59,7 +60,7 @@ class FindOneAndReplace implements Executable
* @param array|object $filter Query by which to filter documents
* @param array|object $replacement Replacement document
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function __construct($databaseName, $collectionName, $filter, $replacement, array $options = [])
{
......@@ -115,6 +116,7 @@ class FindOneAndReplace implements Executable
* @param Server $server
* @return object|null
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
public function execute(Server $server)
{
......
......@@ -3,6 +3,7 @@
namespace MongoDB\Operation;
use MongoDB\Driver\Server;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Exception\UnsupportedException;
......@@ -59,7 +60,7 @@ class FindOneAndUpdate implements Executable
* @param array|object $filter Query by which to filter documents
* @param array|object $update Update to apply to the matched document
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function __construct($databaseName, $collectionName, $filter, $update, array $options = [])
{
......@@ -115,6 +116,7 @@ class FindOneAndUpdate implements Executable
* @param Server $server
* @return object|null
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
public function execute(Server $server)
{
......
......@@ -6,6 +6,7 @@ use MongoDB\InsertManyResult;
use MongoDB\Driver\BulkWrite as Bulk;
use MongoDB\Driver\Server;
use MongoDB\Driver\WriteConcern;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException;
/**
......@@ -42,7 +43,7 @@ class InsertMany implements Executable
* @param string $collectionName Collection name
* @param array[]|object[] $documents List of documents to insert
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function __construct($databaseName, $collectionName, array $documents, array $options = [])
{
......@@ -90,6 +91,7 @@ class InsertMany implements Executable
* @see Executable::execute()
* @param Server $server
* @return InsertManyResult
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
public function execute(Server $server)
{
......
......@@ -6,6 +6,7 @@ use MongoDB\InsertOneResult;
use MongoDB\Driver\BulkWrite as Bulk;
use MongoDB\Driver\Server;
use MongoDB\Driver\WriteConcern;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException;
/**
......@@ -38,7 +39,7 @@ class InsertOne implements Executable
* @param string $collectionName Collection name
* @param array|object $document Document to insert
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function __construct($databaseName, $collectionName, $document, array $options = [])
{
......@@ -66,6 +67,7 @@ class InsertOne implements Executable
* @see Executable::execute()
* @param Server $server
* @return InsertOneResult
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
public function execute(Server $server)
{
......
......@@ -5,6 +5,7 @@ namespace MongoDB\Operation;
use MongoDB\Driver\Command;
use MongoDB\Driver\Query;
use MongoDB\Driver\Server;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Model\CollectionInfoCommandIterator;
use MongoDB\Model\CollectionInfoIterator;
......@@ -36,7 +37,7 @@ class ListCollections implements Executable
*
* @param string $databaseName Database name
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function __construct($databaseName, array $options = [])
{
......@@ -58,6 +59,8 @@ class ListCollections implements Executable
* @see Executable::execute()
* @param Server $server
* @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)
{
......@@ -72,6 +75,7 @@ class ListCollections implements Executable
*
* @param Server $server
* @return CollectionInfoCommandIterator
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
private function executeCommand(Server $server)
{
......@@ -97,7 +101,8 @@ class ListCollections implements Executable
*
* @param Server $server
* @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)
{
......
......@@ -4,6 +4,7 @@ namespace MongoDB\Operation;
use MongoDB\Driver\Command;
use MongoDB\Driver\Server;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Exception\UnexpectedValueException;
use MongoDB\Model\DatabaseInfoIterator;
......@@ -29,7 +30,7 @@ class ListDatabases implements Executable
* run.
*
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function __construct(array $options = [])
{
......@@ -47,6 +48,7 @@ class ListDatabases implements Executable
* @param Server $server
* @return DatabaseInfoIterator
* @throws UnexpectedValueException if the command response was malformed
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
public function execute(Server $server)
{
......
......@@ -5,7 +5,7 @@ namespace MongoDB\Operation;
use MongoDB\Driver\Command;
use MongoDB\Driver\Query;
use MongoDB\Driver\Server;
use MongoDB\Driver\Exception\RuntimeException;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Model\IndexInfoIterator;
use MongoDB\Model\IndexInfoIteratorIterator;
......@@ -39,7 +39,7 @@ class ListIndexes implements Executable
* @param string $databaseName Database name
* @param string $collectionName Collection name
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function __construct($databaseName, $collectionName, array $options = [])
{
......@@ -58,6 +58,7 @@ class ListIndexes implements Executable
* @see Executable::execute()
* @param Server $server
* @return IndexInfoIterator
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
public function execute(Server $server)
{
......@@ -72,6 +73,7 @@ class ListIndexes implements Executable
*
* @param Server $server
* @return IndexInfoIteratorIterator
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
private function executeCommand(Server $server)
{
......@@ -83,7 +85,7 @@ class ListIndexes implements Executable
try {
$cursor = $server->executeCommand($this->databaseName, new Command($cmd));
} catch (RuntimeException $e) {
} catch (DriverRuntimeException $e) {
/* The server may return an error if the collection does not exist.
* Check for possible error codes (see: SERVER-20463) and return an
* empty iterator instead of throwing.
......@@ -106,6 +108,7 @@ class ListIndexes implements Executable
*
* @param Server $server
* @return IndexInfoIteratorIterator
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
private function executeLegacy(Server $server)
{
......
......@@ -4,6 +4,7 @@ namespace MongoDB\Operation;
use MongoDB\UpdateResult;
use MongoDB\Driver\Server;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Exception\UnsupportedException;
......@@ -41,7 +42,7 @@ class ReplaceOne implements Executable
* @param array|object $filter Query by which to filter documents
* @param array|object $replacement Replacement document
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function __construct($databaseName, $collectionName, $filter, $replacement, array $options = [])
{
......@@ -69,6 +70,7 @@ class ReplaceOne implements Executable
* @param Server $server
* @return UpdateResult
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
public function execute(Server $server)
{
......
......@@ -6,6 +6,7 @@ use MongoDB\UpdateResult;
use MongoDB\Driver\BulkWrite as Bulk;
use MongoDB\Driver\Server;
use MongoDB\Driver\WriteConcern;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Exception\UnsupportedException;
......@@ -57,7 +58,7 @@ class Update implements Executable
* @param array|object $update Update to apply to the matched
* document(s) or a replacement document
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function __construct($databaseName, $collectionName, $filter, $update, array $options = [])
{
......@@ -112,6 +113,7 @@ class Update implements Executable
* @param Server $server
* @return UpdateResult
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
public function execute(Server $server)
{
......
......@@ -4,6 +4,7 @@ namespace MongoDB\Operation;
use MongoDB\UpdateResult;
use MongoDB\Driver\Server;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Exception\UnsupportedException;
......@@ -41,7 +42,7 @@ class UpdateMany implements Executable
* @param array|object $filter Query by which to filter documents
* @param array|object $update Update to apply to the matched documents
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function __construct($databaseName, $collectionName, $filter, $update, array $options = [])
{
......@@ -69,6 +70,7 @@ class UpdateMany implements Executable
* @param Server $server
* @return UpdateResult
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
public function execute(Server $server)
{
......
......@@ -4,6 +4,7 @@ namespace MongoDB\Operation;
use MongoDB\UpdateResult;
use MongoDB\Driver\Server;
use MongoDB\Driver\Exception\RuntimeException as DriverRuntimeException;
use MongoDB\Exception\InvalidArgumentException;
use MongoDB\Exception\UnsupportedException;
......@@ -41,7 +42,7 @@ class UpdateOne implements Executable
* @param array|object $filter Query by which to filter documents
* @param array|object $update Update to apply to the matched document
* @param array $options Command options
* @throws InvalidArgumentException
* @throws InvalidArgumentException for parameter/option parsing errors
*/
public function __construct($databaseName, $collectionName, $filter, $update, array $options = [])
{
......@@ -69,6 +70,7 @@ class UpdateOne implements Executable
* @param Server $server
* @return UpdateResult
* @throws UnsupportedException if collation is used and unsupported
* @throws DriverRuntimeException for other driver errors (e.g. connection errors)
*/
public function execute(Server $server)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment