MongoDBClient-getWriteConcern.txt 1.17 KB
Newer Older
1
==================================
2
MongoDB\\Client::getWriteConcern()
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::getWriteConcern()

18
   Returns the write concern for this client.
19 20 21 22 23 24 25 26

   .. code-block:: php

      function getWriteConcern(): MongoDB\Driver\WriteConcern

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

27 28
A :php:`MongoDB\\Driver\\WriteConcern <class.mongodb-driver-writeconcern>`
object.
29 30 31 32 33 34 35 36

Example
-------

.. code-block:: php

   <?php

37 38 39 40 41 42 43 44 45 46 47 48
   $client = new MongoDB\Client('mongodb://127.0.0.1/', [
       'journal' => true,
   ]);

   var_dump($client->getWriteConcern());

The output would then resemble::

   object(MongoDB\Driver\WriteConcern)#4 (1) {
     ["j"]=>
     bool(true)
   }
49 50 51 52

See Also
--------

53 54
- :manual:`Write Concern </reference/read-concern>` in the MongoDB manual
- :php:`MongoDB\\Driver\\WriteConcern::isDefault() <mongodb-driver-writeconcern.isdefault>`
55 56
- :phpmethod:`MongoDB\\Collection::getWriteConcern()`
- :phpmethod:`MongoDB\\Database::getWriteConcern()`
57
- :phpmethod:`MongoDB\\GridFS\\Bucket::getWriteConcern()`