2
2
3
3
.. _replica-set-read-preference-tag-sets:
4
4
5
- ========================
6
- Read Preference Tag Sets
7
- ========================
5
+ =============================
6
+ Read Preference Tag Set Lists
7
+ =============================
8
8
9
9
.. default-domain:: mongodb
10
10
@@ -15,8 +15,8 @@ Read Preference Tag Sets
15
15
:class: singlecol
16
16
17
17
If a replica set member or members are associated with
18
- :rsconf:`~members[n].tags`, you can specify a tag set (array of tag
19
- specification documents ) in the read preference to target those members.
18
+ :rsconf:`~members[n].tags`, you can specify a tag set list (array of tag
19
+ sets ) in the read preference to target those members.
20
20
21
21
To :ref:`configure <replica-set-configuration-document>` a member with
22
22
tags, set :rsconf:`members[n].tags` to a document that contains the tag
@@ -27,9 +27,9 @@ name and value pairs. The value of the tags must be a string.
27
27
28
28
{ "<tag1>": "<string1>", "<tag2>": "<string2>",... }
29
29
30
- Then, you can include a tag set in the read preference to target tagged
31
- members. A tag set is an array of tag specification documents , where
32
- each tag specification document contains one or more tag/value pairs.
30
+ Then, you can include a tag set list in the read preference to target
31
+ tagged members. A tag set list is an array of tag sets , where each
32
+ tag set contains one or more tag/value pairs.
33
33
34
34
.. code-block:: javascript
35
35
:copyable: false
@@ -46,8 +46,8 @@ For example, if a secondary member has the following
46
46
47
47
{ "region": "South", "datacenter": "A" }
48
48
49
- Then, the following tags sets can direct read operations to the aforementioned
50
- secondary (or other members with the same tags):
49
+ Then, the following tag set lists can direct read operations to the
50
+ aforementioned secondary (or other members with the same tags):
51
51
52
52
.. code-block:: javascript
53
53
:copyable: false
@@ -65,21 +65,20 @@ secondary (or other members with the same tags):
65
65
Order of Tag Matching
66
66
---------------------
67
67
68
- If the tag set lists multiple documents, MongoDB tries each document in
69
- succession until a match is found. Once a match is found, that tag
70
- specification document is used to find all eligible matching members,
71
- and the remaining tag specification documents are ignored. If no
72
- members match any of the tag specification documents, the read
73
- operation returns with an error.
68
+ If the tag set list contains multiple documents, MongoDB tries each
69
+ document in succession until a match is found. Once a match is found,
70
+ that tag set is used to find all eligible matching members, and the
71
+ remaining tag sets are ignored. If no members match any of the tag
72
+ sets, the read operation returns with an error.
74
73
75
74
.. tip::
76
75
77
76
To avoid an error if no members match any of the tag specifications,
78
77
you can add an empty document ``{ }`` as the last element of the tag
79
- set to read from any eligible member.
78
+ set list to read from any eligible member.
80
79
81
- For example, consider the following tag set with three tag
82
- specification documents :
80
+ For example, consider the following tag set list with three tag
81
+ sets :
83
82
84
83
.. code-block:: javascript
85
84
:copyable: false
@@ -95,9 +94,8 @@ First, MongoDB tries to find members tagged with both ``"region":
95
94
{ "region": "South", "datacenter": "A" }
96
95
97
96
98
- - If a member is found, the remaining tag specification documents are
99
- not considered. Instead, MongoDB uses this tag specification document
100
- to find all eligible members.
97
+ - If a member is found, the remaining tag sets are not considered.
98
+ Instead, MongoDB uses this tag set to find all eligible members.
101
99
102
100
- Else, MongoDB tries to find members with the tags specified in the
103
101
second document
@@ -107,9 +105,8 @@ First, MongoDB tries to find members tagged with both ``"region":
107
105
108
106
{ "rack": "rack-1" }
109
107
110
- - If a member is found tagged, the remaining tag specification
111
- document is not considered. Instead, MongoDB uses this tag
112
- specification document to find all eligible members.
108
+ - If a member is found tagged, the remaining tag set is not considered.
109
+ Instead, MongoDB uses this tag set to find all eligible members.
113
110
114
111
- Else, the third document is considered.
115
112
@@ -120,13 +117,13 @@ First, MongoDB tries to find members tagged with both ``"region":
120
117
121
118
The empty document matches any eligible member.
122
119
123
- Tag Set and Read Preference Modes
124
- ---------------------------------
120
+ Tag Set List and Read Preference Modes
121
+ --------------------------------------
125
122
126
123
Tags are not compatible with mode :readmode:`primary`, and in general,
127
124
only apply when :ref:`selecting <replica-set-read-preference-behavior-member-selection>`
128
125
a :term:`secondary` member of a set for a read operation. However, the
129
- :readmode:`nearest` read mode, when combined with a tag set, selects
126
+ :readmode:`nearest` read mode, when combined with a tag set list , selects
130
127
the matching member with the lowest network latency. This member may be a
131
128
primary or secondary.
132
129
@@ -138,22 +135,22 @@ primary or secondary.
138
135
- Notes
139
136
140
137
* - :readmode:`primaryPreferred`
141
- - Specified tag set only applies if selecting eligible secondaries.
138
+ - Specified tag set list only applies if selecting eligible secondaries.
142
139
143
140
* - :readmode:`secondary`
144
- - Specified tag set always applies.
141
+ - Specified tag set list always applies.
145
142
146
143
* - :readmode:`secondaryPreferred`
147
- - Specified tag set only applies if selecting eligible secondaries.
144
+ - Specified tag set list only applies if selecting eligible secondaries.
148
145
149
146
* - :readmode:`nearest`
150
147
151
- - Specified tag set applies whether selecting either primary or eligible secondaries.
148
+ - Specified tag set list applies whether selecting either primary or eligible secondaries.
152
149
153
150
For information on the interaction between the :ref:`modes
154
- <replica-set-read-preference-modes>` and tag sets , refer to the
151
+ <replica-set-read-preference-modes>` and tag set lists , refer to the
155
152
:ref:`specific read preference mode documentation
156
153
<replica-set-read-preference-modes>`.
157
154
158
- For information on configuring tag sets , see the
155
+ For information on configuring tag set lists , see the
159
156
:doc:`/tutorial/configure-replica-set-tag-sets` tutorial.
0 commit comments