MongoDBClient-getReadConcern.txt 1.2 KB
Newer Older
1
=================================
2
MongoDB\\Client::getReadConcern()
3
=================================
4

5 6
.. versionadded:: 1.2

7 8 9 10 11 12 13 14 15 16 17 18 19
.. default-domain:: mongodb

.. contents:: On this page
   :local:
   :backlinks: none
   :depth: 1
   :class: singlecol

Definition
----------

.. phpmethod:: MongoDB\\Client::getReadConcern()

20
   Returns the read concern for this client.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37

   .. code-block:: php

      function getReadConcern(): MongoDB\Driver\ReadConcern

Return Values
-------------

A :php:`MongoDB\\Driver\\ReadConcern <class.mongodb-driver-readconcern>` object.

Example
-------

.. code-block:: php

   <?php

38 39 40 41 42 43 44
   $client = new MongoDB\Client('mongodb://127.0.0.1/', [
       'readConcernLevel' => 'majority',
   ]);

   var_dump($client->getReadConcern());

The output would then resemble::
45

46 47 48 49
   object(MongoDB\Driver\ReadConcern)#5 (1) {
     ["level"]=>
     string(8) "majority"
   }
50 51 52 53

See Also
--------

54 55
- :manual:`Read Concern </reference/read-concern>` in the MongoDB manual
- :php:`MongoDB\\Driver\\ReadConcern::isDefault() <mongodb-driver-readconcern.isdefault>`
56 57
- :phpmethod:`MongoDB\\Collection::getReadConcern()`
- :phpmethod:`MongoDB\\Database::getReadConcern()`
58
- :phpmethod:`MongoDB\\GridFS\\Bucket::getReadConcern()`