php8.5
Home/ Manual/ driver / readconcern/ MongoDB\Driver\ReadConcern::getLevel

MongoDB\Driver\ReadConcern::getLevel

PHP function Edit on GitHub ✎

(mongodb >=1.0.0)

Returns the ReadConcern's "level" option

Description

MongoDB\Driver\ReadConcern::getLevel(): string|null

Parameters Parameters

Return Values

Returns the ReadConcern's "level" option.

Errors/Exceptions

Examples

MongoDB\Driver\ReadConcern::getLevel() example

php
<?php

$rc = new MongoDB\Driver\ReadConcern();
var_dump($rc->getLevel());

$rc = new MongoDB\Driver\ReadConcern(MongoDB\Driver\ReadConcern::LOCAL);
var_dump($rc->getLevel());

$rc = new MongoDB\Driver\ReadConcern(MongoDB\Driver\ReadConcern::MAJORITY);
var_dump($rc->getLevel());

?>

The above example will output:

output
NULL
string(5) "local"
string(8) "majority"

See Also

  • Read Concern reference

Source: reference/mongodb/mongodb/driver/readconcern/getlevel.xml · from the official PHP manual (php/doc-en)