« MongoDB\Driver\Exception\BulkWriteCommandException::getPartialResult
MongoDB\Driver\Exception\BulkWriteCommandException::getWriteErrors »

MongoDB\Driver\Exception\BulkWriteCommandException::getWriteConcernErrors

(mongodb >=2.1.0)

MongoDB\Driver\Exception\BulkWriteCommandException::getWriteConcernErrors — Returns any write concern errors

説明

final public function MongoDB\Driver\Exception\BulkWriteCommandException::getWriteConcernErrors(): array

パラメータ

この関数にはパラメータはありません。

戻り値

An array of any MongoDB\Driver\WriteConcernErrors that occurred while executing the bulk write. This list may have multiple items if more than one server command was required to execute the bulk write.

例

例1 MongoDB\Driver\Exception\BulkWriteCommandException::getWriteConcernErrors() example

<?php

$manager = new MongoDB\Driver\Manager;

$bulk = new MongoDB\Driver\BulkWriteCommand;
$bulk->insertOne('db.coll', ['x' => 1]);

$writeConcern = new MongoDB\Driver\WriteConcern(50);

try {
    $result = $manager->executeBulkWriteCommand($bulk, ['writeConcern' => $writeConcern]);
} catch (MongoDB\Driver\Exception\BulkWriteCommandException $e) {
    var_dump($e->getWriteConcernErrors());
}

?>

上の例の出力は、 たとえば以下のようになります。

array(1) {
  [0]=>
  object(MongoDB\Driver\WriteConcernError)#6 (3) {
    ["message"]=>
    string(29) "Not enough data-bearing nodes"
    ["code"]=>
    int(100)
    ["info"]=>
    object(stdClass)#8 (1) {
      ["writeConcern"]=>
      object(stdClass)#7 (3) {
        ["w"]=>
        int(50)
        ["wtimeout"]=>
        int(0)
        ["provenance"]=>
        string(14) "clientSupplied"
      }
    }
  }
}
関連キーワード:
MongoDB   Driver   Exception   BulkWriteCommandException   write   getWriteConcernErrors   bulk   writeConcern   concern   errors   WriteConcernError   command   manager   Manager   WriteConcern   executeBulkWriteCommand   stdClass   getPartialResult   getWriteErrors   mongodb   final   occurred   while   executing   list
関連する関数・ページ:
mongodb-driver-bulkwritecommandexception.getwriteerrors   mongodb-driver-bulkwritecommandexception.geterrorreply   mongodb-driver-bulkwritecommandexception.getpartialresult   class.mongodb-driver-exception-bulkwritecommandexception   mongodb-driver-writeresult.getwriteconcernerror   mongodb-driver-writeconcernerror.getcode