MongoDBClient-getReadConcern.txt 1.18 KB
Newer Older
1
=================================
2
MongoDB\\Client::getReadConcern()
3
=================================
4 5 6 7 8 9 10 11 12 13 14 15 16 17

.. default-domain:: mongodb

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

Definition
----------

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

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

   .. 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

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

   var_dump($client->getReadConcern());

The output would then resemble::
43

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

See Also
--------

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