|
MongoDB\Driver\Manager::executeCommandExecute a database command 説明
final public MongoDB\Driver\Cursor MongoDB\Driver\Manager::executeCommand(string
$db , MongoDB\Driver\Command $command , arrayMongoDB\Driver\ReadPreferencenull $options = null )
Selects a server according to the
This method applies no special logic to the command. Although this method
accepts パラメータ
戻り値Returns MongoDB\Driver\Cursor on success. エラー / 例外
変更履歴
例例1 MongoDB\Driver\Manager::executeCommand with a command returning a single result document
<?php 上の例の出力は以下となります。 array(1) { ["ok"]=> float(1) } 例2 MongoDB\Driver\Manager::executeCommand with a command returning a cursor
<?php 上の例の出力は以下となります。 object(stdClass)#6 (2) { ["_id"]=> string(3) "bar" ["sum"]=> int(10) } object(stdClass)#7 (2) { ["_id"]=> string(3) "foo" ["sum"]=> int(2) } 例3 Limiting execution time for a command
The execution time of a command may be limited by specifying a value for
<?php If the command fails to complete after one second of execution time on the server, a MongoDB\Driver\Exception\ExecutionTimeoutException will be thrown. 注意
参考
|