File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
includes/databases-collections Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -264,10 +264,13 @@ pass them as a parameter to your ``MongoDB\Driver\ReadPreference`` class
264
264
constructor. Then, set the ``MongoDB\Driver\ReadPreference`` object as
265
265
the value of the ``readPreference`` database option.
266
266
267
- The following code example sets the ``readPreference`` option to a tag set
268
- that instructs ``test_database`` to prefer reads from the New York data
269
- center (``'dc' => 'ny'``) and to fall back to the San Francisco data
270
- center (``'dc' => 'sf'``):
267
+ This code example sets the ``readPreference`` option to a tag set
268
+ that instructs ``test_database`` to prefer reads from secondary replica set
269
+ members in the following order:
270
+
271
+ 1. Members from the New York data center (``['dc' => 'ny']``)
272
+ #. Members from the San Francisco data center (``['dc' => 'sf']``)
273
+ #. Any secondary members (``[]``)
271
274
272
275
.. literalinclude:: /includes/databases-collections/databases-collections.php
273
276
:language: php
Original file line number Diff line number Diff line change 73
73
// end-collection-settings
74
74
75
75
// Instructs the library to prefer reads from secondary replica set members
76
- // located in New York but fall back to those in San Francisco
76
+ // located in New York, followed by a secondary in San Francisco, and
77
+ // lastly fall back to any secondary.
77
78
// start-tag-set
78
79
$ readPreference = new ReadPreference (
79
80
ReadPreference::RP_SECONDARY ,
You can’t perform that action at this time.
0 commit comments