GoLang MongoDB\Driver\WriteResult::isAcknowledged

request it (378)
GoLang replacement for PHP's MongoDB\Driver\WriteResult::isAcknowledged [edit | history]



Do you know a GoLang replacement for PHP's MongoDB\Driver\WriteResult::isAcknowledged? Write it!

PHP MongoDB\Driver\WriteResult::isAcknowledged

PHP original manual for MongoDB\Driver\WriteResult::isAcknowledged [ show | php.net ]

MongoDB\Driver\WriteResult::isAcknowledged

(mongodb >=1.0.0)

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

Description

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

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

Parameters

This function has no parameters.

Return Values

Returns TRUE if the write was acknowledged, and FALSE otherwise.

Errors/Exceptions

Examples

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

?>

The above example will output:

bool(true)

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

?>

The above example will output:

bool(false)