Returns whether the write was acknowledged

# MongoDB\Driver\WriteResult::isAcknowledged

(mongodb >=1.0.0)

MongoDB\Driver\WriteResult::isAcknowledged — Returns whether the write was acknowledged

### Beschreibung

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

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

### Parameter-Liste

Diese Funktion besitzt keine Parameter.

### Rückgabewerte

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

### Fehler/Exceptions

- Wirft eine MongoDB\Driver\Exception\InvalidArgumentException, wenn beim Analysieren von Argumenten ein Fehler auftritt.

### Beispiele

Beispiel #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());

    ?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

    bool(true)

Beispiel #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());

    ?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

    bool(false)

### Siehe auch

- MongoDB\Driver\WriteConcern
- » Write Concern reference

`↑` and `↓` to navigate • `Enter` to select • `Esc` to close • `/` to open