For AI agents: a documentation index is available at https://www.mongodb.com/es/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.
Make the MongoDB docs better! We value your opinion. Share your feedback for a chance to win $100.
MongoDB Branding Shape
Click here >
Docs Menu

MongoDB\Client::getWriteConcern()

New in version 1.2. :

MongoDB\Client::getWriteConcern()

Returns the write concern for this client.

function getWriteConcern(): MongoDB\Driver\WriteConcern

A MongoDB\Driver\WriteConcern object.

<?php
$client = new MongoDB\Client('mongodb://127.0.0.1/', [
'journal' => true,
]);
var_dump($client->getWriteConcern());

The output would then resemble:

object(MongoDB\Driver\WriteConcern)#4 (1) {
["j"]=>
bool(true)
}