Docs Menu

Docs HomePHP Library Manual

MongoDB\Collection::getReadConcern()

On this page

  • Definition
  • Return Values
  • Example
  • See Also

New in version 1.2.

MongoDB\\Collection::getReadConcern()

Returns the read concern for this collection.

function getReadConcern(): MongoDB\Driver\ReadConcern

A MongoDB\\Driver\\ReadConcern object.

<?php
$collection = (new MongoDB\Client)->selectCollection('test', 'users', [
'readConcern' => new MongoDB\Driver\ReadConcern('majority'),
]);
var_dump($collection->getReadConcern());

The output would then resemble:

object(MongoDB\Driver\ReadConcern)#5 (1) {
["level"]=>
string(8) "majority"
}
←  MongoDB\Collection::getNamespace()MongoDB\Collection::getReadPreference() →