MongoDB\Driver\Server::executeQuery
PHP function
Edit on GitHub ✎
(mongodb >=1.0.0)
Execute a database query on this server
Description
MongoDB\Driver\Server::executeQuery(string $namespace, MongoDB\Driver\Query $query, array|null $options = null): MongoDB\Driver\Cursor
Executes the query on this server.
Default values for the "readPreference" option and Query's "readConcern" option will be inferred from an active transaction (indicated by the "session" option), followed by the connection URI.
Readpreference
Parameters
optionsOption Type Description
Return Values Cursor
Errors/Exceptions
- Throws
MongoDB\Driver\Exception\RuntimeExceptionon other errors (e.g. invalid query operators).
Changelog
| Version | Description |
|---|---|
| PECL mongodb 2.0.0 | The options parameter no longer accepts a MongoDB\Driver\ReadPreference instance. |
| PECL mongodb 1.21.0 | Passing a MongoDB\Driver\ReadPreference object as options is deprecated and will be removed in 2.0. |
| PECL mongodb 1.4.0 | The third parameter is now an options array. For backwards compatibility, this parameter will still accept a MongoDB\Driver\ReadPreference object. |
See Also
MongoDB\Driver\CursorMongoDB\Driver\QueryMongoDB\Driver\ReadPreferenceMongoDB\Driver\Manager::executeQuery()