Navigation
This version of the documentation is archived and no longer supported. To learn how to upgrade your version of PHP Library Manual, refer to the upgrade documentation.

MongoDB\Collection::getWriteConcern()

New in version 1.2.

Definition

MongoDB\Collection::getWriteConcern

Returns the write concern for this collection.

function getWriteConcern(): MongoDB\Driver\WriteConcern

Return Values

A MongoDB\Driver\WriteConcern object.

Example

<?php

$collection = (new MongoDB\Client)->selectCollection('test', 'users', [
   'writeConcern' => new MongoDB\Driver\WriteConcern(1, 0, true),
]);

var_dump($collection->getWriteConcern());

The output would then resemble:

object(MongoDB\Driver\WriteConcern)#5 (2) {
  ["w"]=>
  int(1)
  ["j"]=>
  bool(true)
}