For AI agents: a documentation index is available at https://www.mongodb.com/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.

MongoDB\Database::getWriteConcern()

New in version 1.2.

MongoDB\Database::getWriteConcern()

Returns the write concern for this database.

function getWriteConcern(): MongoDB\Driver\WriteConcern

A MongoDB\Driver\WriteConcern object.

<?php $database = (new MongoDB\Client)->getDatabase('test', [ 'writeConcern' => new MongoDB\Driver\WriteConcern(1, 0, true),]); var_dump($database->getWriteConcern());

The output would then resemble:

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