Skip to content

Commit fc13bf4

Browse files
author
Chris Cho
committed
divide files
1 parent 7feae62 commit fc13bf4

File tree

4 files changed

+14
-30
lines changed

4 files changed

+14
-30
lines changed
Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
// start findOneAndDelete example without collation
2-
/*
3-
Delete the first document that contains a value greater
4-
than 100 in the "a" field when ordered by using the default
5-
binary collation order.
6-
*/
7-
await myColl.findOneAndDelete({ a: { $gt: "100" } });
8-
// end findOneAndDelete example without collation
9-
10-
// start findOneAndDelete example with collation
111
/*
122
Delete the first document that contains a value greater
133
than 100 in the "a" field when ordered by using the
@@ -16,5 +6,4 @@ await myColl.findOneAndDelete({ a: { $gt: "100" } });
166
myColl.findOneAndDelete(
177
{ a: { $gt: "100" } },
188
{ collation: { locale: "en", numericOrdering: true } },
19-
);
20-
// end findOneAndDelete example with collation
9+
);
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/*
2+
Delete the first document that contains a value greater
3+
than 100 in the "a" field when ordered by using the default
4+
binary collation order.
5+
*/
6+
await myColl.findOneAndDelete({ a: { $gt: "100" } });
Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
1-
// start findOneAndUpdate without collation
2-
/*
3-
Update the "verified" field to "true" for the first document
4-
that precedes "Gunter" when ordered by using the
5-
default binary collation order.
6-
*/
7-
myColl.findOneAndUpdate(
8-
{ first_name : { $lt: "Gunter" } },
9-
{ $set: { verified: true } }
10-
);
11-
// end findOneAndUpdate without collation
12-
13-
// start findOneAndUpdate with collation
141
/*
152
Update the "verified" field to "true" for the first document
163
that precedes "Gunter" when ordered by using the
@@ -20,5 +7,4 @@ myColl.findOneAndUpdate(
207
{ first_name: { $lt: "Gunter" } },
218
{ $set: { verified: true } },
229
{ collation: { locale: "de@collation=phonebook" } },
23-
);
24-
// end findOneAndUpdate with collation
10+
);

source/fundamentals/collations.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ a collection with a collation set to the "``en_US``" locale.
149149

150150
.. literalinclude:: /code-snippets/collation/index-collation.js
151151
:language: javascript
152+
:lineno-start: 5
152153

153154
The following query uses the index we created:
154155

@@ -158,6 +159,7 @@ The following query uses the index we created:
158159
:end-before: end query index collation
159160
:emphasize-lines: 6-7
160161

162+
161163
The following queries **do not** use the index that we created. The first
162164
query does not include a collation and the second contains a different
163165
strength value than the collation on the index.
@@ -254,6 +256,8 @@ lexical order.
254256

255257
.. literalinclude:: /code-snippets/collation/findOneAndDelete-collation.js
256258
:language: javascript
259+
:lineno-start: 6
260+
257261
:start-after: start findOneAndDelete example with collation
258262
:end-before: end findOneAndDelete example with collation
259263

@@ -270,10 +274,9 @@ collection of three documents, it matches documents based on the lexical value
270274
of the strings ("``16``", "``84``", and "``179``"), and deletes the first
271275
document it finds that matches the query criteria.
272276

273-
.. literalinclude:: /code-snippets/collation/findOneAndDelete-collation.js
277+
.. literalinclude:: /code-snippets/collation/findOneAndDelete-no-collation.js
274278
:language: javascript
275-
:start-after: start findOneAndDelete example without collation
276-
:end-before: end findOneAndDelete example without collation
279+
:lineno-start: 6
277280

278281
Since all the documents contain lexical values in the ``a`` field that
279282
match the criteria (greater than the lexical value of "``100``"), the operation

0 commit comments

Comments
 (0)