|
MongoDB\Driver\Manager::executeCommandExecute a database command Description
final public MongoDB\Driver\Cursor MongoDB\Driver\Manager::executeCommand
( string
$db
, MongoDB\Driver\Command $command
[, MongoDB\Driver\ReadPreference $readPreference
] )
Executes Parameters
Return ValuesReturns MongoDB\Driver\Cursor on success. Errors/Exceptions
ExamplesExample #1 MongoDB\Driver\Manager::executeCommand with a command returning a single result document
<?php The above example will output: array(1) { ["ok"]=> float(1) } Example #2 MongoDB\Driver\Manager::executeCommand with a command returning a cursor
<?php The above example will output: object(stdClass)#6 (2) { ["_id"]=> string(3) "bar" ["sum"]=> int(10) } object(stdClass)#7 (2) { ["_id"]=> string(3) "foo" ["sum"]=> int(2) } Notes
See Also
|