array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ja', ), 'this' => array ( 0 => 'mongodb-driver-writeresult.isacknowledged.php', 1 => 'MongoDB\\Driver\\WriteResult::isAcknowledged', 2 => 'Returns whether the write was acknowledged', ), 'up' => array ( 0 => 'class.mongodb-driver-writeresult.php', 1 => 'MongoDB\\Driver\\WriteResult', ), 'prev' => array ( 0 => 'mongodb-driver-writeresult.getwriteerrors.php', 1 => 'MongoDB\\Driver\\WriteResult::getWriteErrors', ), 'next' => array ( 0 => 'class.mongodb-driver-bulkwritecommandresult.php', 1 => 'MongoDB\\Driver\\BulkWriteCommandResult', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/mongodb/mongodb/driver/writeresult/isacknowledged.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

MongoDB\Driver\WriteResult::isAcknowledged

(mongodb >=1.0.0)

MongoDB\Driver\WriteResult::isAcknowledgedReturns whether the write was acknowledged

説明

final public MongoDB\Driver\WriteResult::isAcknowledged(): bool

If the write is acknowledged, other count fields will be available on the MongoDB\Driver\WriteResult object.

パラメータ

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

戻り値

Returns true if the write was acknowledged, and false otherwise.

エラー / 例外

例1 MongoDB\Driver\WriteResult::isAcknowledged() with acknowledged write concern

<?php

$manager
= new MongoDB\Driver\Manager;

$bulk = new MongoDB\Driver\BulkWrite;
$bulk->insert(['x' => 1]);

$result = $manager->executeBulkWrite('db.collection', $bulk);

var_dump($result->isAcknowledged());

?>

上の例の出力は以下となります。

bool(true)

例2 MongoDB\Driver\WriteResult::isAcknowledged() with unacknowledged write concern

<?php

$manager
= new MongoDB\Driver\Manager;

$bulk = new MongoDB\Driver\BulkWrite;
$bulk->insert(['x' => 1]);

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

$result = $manager->executeBulkWrite('db.collection', $bulk, ['writeConcern' => $writeConcern]);

var_dump($result->isAcknowledged());

?>

上の例の出力は以下となります。

bool(false)

参考