@@ -120,23 +120,26 @@ collection.
120
120
121
121
.. literalinclude:: /code-snippets/collation/collection-collation.js
122
122
:language: javascript
123
- :lineno-start: 2
123
+ :start-after: start collection collation
124
+ :ends-before: end collection collation
124
125
125
126
Any of the operations that support collations automatically apply the collation
126
127
defined on the collection. The query below searches the ``souvenirs``
127
128
collection and applies the "``fr_CA``" locale collation:
128
129
129
130
.. literalinclude:: /code-snippets/collation/collection-auto-collation.js
130
131
:language: javascript
131
- :lineno-start: 2
132
+ :start-after: start auto collation
133
+ :ends-before: end auto collation
132
134
133
135
You can specify a different collation as a parameter in an operation that
134
136
supports collations. The following query specifies the "``is``" Iceland locale
135
137
and ``caseFirst`` optional parameter with the value "``upper``":
136
138
137
139
.. literalinclude:: /code-snippets/collation/collection-specify-collation.js
138
140
:language: javascript
139
- :lineno-start: 5
141
+ :start-after: start specified collation
142
+ :ends-before: end specified collation
140
143
141
144
Assign a Collation to an Index
142
145
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -146,25 +149,27 @@ a collection with a collation set to the "``en_US``" locale.
146
149
147
150
.. literalinclude:: /code-snippets/collation/index-collation.js
148
151
:language: javascript
149
- :lineno-start: 5
152
+ :start-after: start indexcollation
153
+ :ends-before: end indexcollation
150
154
151
155
The following query uses the index we created:
152
156
153
157
.. literalinclude:: /code-snippets/collation/query-index-collation.js
154
158
:language: javascript
155
- :lineno-start: 6
156
159
157
160
The following queries **do not** use the index that we created. The first
158
161
query does not include a collation and the second contains a different
159
162
strength value than the collation on the index.
160
163
161
164
.. literalinclude:: /code-snippets/collation/query-not-indexed-collation.js
162
165
:language: javascript
163
- :lineno-start: 6
166
+ :start-after: start not indexed collation
167
+ :ends-before: end not indexed collation
164
168
165
169
.. literalinclude:: /code-snippets/collation/query-index-no-collation.js
166
170
:language: javascript
167
- :lineno-start: 6
171
+ :start-after: start index no collation
172
+ :ends-before: end index no collation
168
173
169
174
Collation Query Examples
170
175
~~~~~~~~~~~~~~~~~~~~~~~~
@@ -203,7 +208,8 @@ which **does not** specify a collation:
203
208
204
209
.. literalinclude:: /code-snippets/collation/findOneAndUpdate-default-order-collation.js
205
210
:language: javascript
206
- :lineno-start: 6
211
+ :start-after: start findOneAndUpdate collation
212
+ :ends-before: end findOneAndUpdate collation
207
213
208
214
Since "Gunter" is the first sorted result when using a binary collation, none
209
215
of the documents come lexically before and match the ``$lt`` comparison
@@ -219,7 +225,8 @@ umlauts.
219
225
220
226
.. literalinclude:: /code-snippets/collation/findOneAndUpdate-collation.js
221
227
:language: javascript
222
- :lineno-start: 6
228
+ :start-after: start findOneAndUpdate default order collation
229
+ :ends-before: end findOneAndUpdate default order collation
223
230
224
231
Since "Günter" lexically comes before "Gunter" using the
225
232
``de@collation=phonebook`` collation specified in ``findOneAndUpdate()``,
@@ -250,7 +257,8 @@ lexical order.
250
257
251
258
.. literalinclude:: /code-snippets/collation/findOneAndDelete-collation.js
252
259
:language: javascript
253
- :lineno-start: 6
260
+ :start-after: start findOneAndDelete collation
261
+ :ends-before: end findOneAndDelete collation
254
262
255
263
After you run the operation above, the collection contains the following
256
264
documents:
@@ -267,7 +275,8 @@ document it finds that matches the query criteria.
267
275
268
276
.. literalinclude:: /code-snippets/collation/findOneAndDelete-no-collation.js
269
277
:language: javascript
270
- :lineno-start: 6
278
+ :start-after: start findOneAndDelete no collation
279
+ :ends-before: end findOneAndDelete no collation
271
280
272
281
Since all the documents contain lexical values in the ``a`` field that
273
282
match the criteria (greater than the lexical value of "``100``"), the operation
@@ -297,3 +306,5 @@ the German phonebook (``de@collation=phonebook`` locale) order.
297
306
298
307
.. literalinclude:: /code-snippets/collation/aggregation-collation.js
299
308
:language: javascript
309
+ :start-after: start aggregation collation
310
+ :ends-before: end aggregation collation
0 commit comments