MongoDB\Client::getReadConcern()

For the complete MongoDB documentation index, see www.mongodb.com/docs/llms.txt

MongoDB\Client::getReadConcern()

New in version 1.2

Definition

Returns the read concern for this client.

function getReadConcern(): MongoDB\Driver\ReadConcern

Return Values

A MongoDB\Driver\ReadConcern object.

Example

<?php

$client = new MongoDB\Client('mongodb://127.0.0.1/', [
    'readConcernLevel' => 'majority',
]);

var_dump($client->getReadConcern());

The output would then resemble:

object(MongoDB\Driver\ReadConcern)#5 (1) {
  ["level"]=>
  string(8) "majority"
}

See Also

  • Read Concern in the MongoDB manual

  • MongoDB\Driver\ReadConcern::isDefault()

  • [MongoDB\Collection::getReadConcern()](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbcollection-getreadconcern.md#mongodb-phpmethod-phpmethod.MongoDB-Collection--getReadConcern--

  • [MongoDB\Database::getReadConcern()](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbdatabase-getreadconcern.md#mongodb-phpmethod-phpmethod.MongoDB-Database--getReadConcern--

  • [MongoDB\GridFS\Bucket::getReadConcern()](https://www.mongodb.com/docs/php-library/current/reference/method/mongodbgridfsbucket-getreadconcern.md#mongodb-phpmethod-phpmethod.MongoDB-GridFS-Bucket--getReadConcern--