PHP 8.4.2 Released!

MongoDB\Driver\WriteResult::isAcknowledged

(mongodb >=1.0.0)

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

Açıklama

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

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

Bağımsız Değişkenler

Bu işlevin bağımsız değişkeni yoktur.

Dönen Değerler

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

Hatalar/İstisnalar

Örnekler

Örnek 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());

?>

Yukarıdaki örneğin çıktısı:

bool(true)

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

<?php

$manager
= new MongoDB\Driver\Manager;

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

$result = $manager->executeBulkWrite('db.collection', $bulk, new MongoDB\Driver\WriteConcern(0));

var_dump($result->isAcknowledged());

?>

Yukarıdaki örneğin çıktısı:

bool(false)
add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top