Skip to content

Commit d0e6934

Browse files
committed
edits
1 parent 2aab86a commit d0e6934

File tree

3 files changed

+18
-37
lines changed

3 files changed

+18
-37
lines changed

source/includes/read-write-pref.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// end-client-settings
1818

1919
// start-client-settings-uri
20-
$uri = 'mongodb://localhost:27017/?readPreference=secondary&readConcernLevel=local&w=majority';
20+
$uri = 'mongodb://localhost:27017/?readPreference=secondary&readConcernLevel=local&w=2';
2121
$client = new Client($uri);
2222
// end-client-settings-uri
2323

source/index.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ MongoDB PHP Library
1717
/aggregation
1818
/indexes
1919
/security
20+
/read-write-pref
2021
/tutorial
2122
/upgrade
2223
/reference

source/read-write-pref.txt

Lines changed: 16 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -45,44 +45,24 @@ in your replica sets.
4545
Configure Read and Write Operations
4646
-----------------------------------
4747

48-
You can control how the library routes read operations by setting a **read preference**.
49-
You can also control options for how the library waits for acknowledgment of
50-
read and write operations on a replica set by setting a **read concern** and a
51-
**write concern**.
48+
You can control how the library routes read operations by setting a read preference.
49+
You can also control how the library waits for acknowledgment of read and write operations
50+
on a replica set by setting a read and write concern.
5251

5352
This section shows how to configure the read preference, read concern, and write
5453
concern at various levels by passing an options array parameter to the following
5554
methods:
5655

57-
- :ref:`MongoDB\\Client::__construct() <php-read-write-client>`: Configures read
58-
and write settings at the client level
59-
- :ref:`MongoDB\\Client::startSession() <php-read-write-session>`: Configures read
60-
and write settings at the session level
61-
- :ref:`MongoDB\\Driver\\Session::startTransaction() <php-read-write-transaction>`:
62-
Configures read and write settings at the transaction level
63-
- :ref:`MongoDB\\Client::selectDatabase() <php-read-write-database>`: Configures read
64-
and write settings at the database level
65-
- :ref:`MongoDB\\Client::selectCollection() <php-read-write-collection>`: Configures read
66-
and write settings at the collection level
67-
68-
In the options parameter, specify the following values:
69-
70-
- ``readPreference``: Sets the read preference. For a list of available read
71-
preferences, see :php:`MongoDB\Driver\ReadPreference <mongodb-driver-readpreference>`
72-
in the extension API documentation.
73-
- ``readConcern``: Sets the read concern. For a list of available read
74-
concerns, see :php:`MongoDB\Driver\ReadConcern <mongodb-driver-readconcern>`
75-
in the extension API documentation.
76-
- ``writeConcern``: Sets the write concern. For a list of available write
77-
concerns, see :php:`MongoDB\Driver\WriteConcern <mongodb-driver-writeconcern>`
78-
in the extension API documentation.
79-
80-
.. note::
81-
82-
When setting a write concern at the ``MongoDB\Client`` level, specify the ``w``
83-
value in an options array rather than ``writeConcern.`` You can also specify
84-
read and write settings in the connection URI. For more information,
85-
see the :ref:`php-read-write-client`.
56+
- :ref:`MongoDB\Client::__construct() <php-read-write-client>`: Configures client-level
57+
settings
58+
- :ref:`MongoDB\Client::startSession() <php-read-write-session>`: Configures session-level
59+
settings
60+
- :ref:`MongoDB\Driver\Session::startTransaction() <php-read-write-transaction>`:
61+
Configures transaction-level settings
62+
- :ref:`MongoDB\Client::selectDatabase() <php-read-write-database>`: Configures
63+
database-level settings
64+
- :ref:`MongoDB\Client::selectCollection() <php-read-write-collection>`: Configures read
65+
collection-level settings
8666

8767
.. _php-read-write-client:
8868

@@ -179,7 +159,7 @@ array to the ``selectDatabase()`` method. The code configures the following sett
179159
- ``MAJORITY`` write concern: The majority of all replica set members
180160
must acknowledge the write operation
181161

182-
.. literalinclude:: /includes/databases-collections/databases-collections.php
162+
.. literalinclude:: /includes/read-write-pref.php
183163
:language: php
184164
:dedent:
185165
:start-after: start-database-settings
@@ -201,7 +181,7 @@ array to the ``selectCollection()`` method. The code configures the following se
201181
set members
202182
- ``0`` write concern: Requests no acknowledgment of the write operation
203183

204-
.. literalinclude:: /includes/databases-collections/databases-collections.php
184+
.. literalinclude:: /includes/read-write-pref.php
205185
:language: php
206186
:dedent:
207187
:start-after: start-collection-settings
@@ -299,6 +279,6 @@ guide, see the following API documentation:
299279

300280
- :phpmethod:`MongoDB\Client::__construct()`
301281
- :phpmethod:`MongoDB\Client::startSession()`
302-
- :php:`MongoDB\Driver\Session::startTransaction()`
282+
- :php:`MongoDB\Driver\Session::startTransaction`
303283
- :phpmethod:`MongoDB\Client::selectDatabase()`
304284
- :phpmethod:`MongoDB\Client::selectCollection()`

0 commit comments

Comments
 (0)