Skip to content

Commit 46e28b2

Browse files
committed
more awaits
1 parent a412271 commit 46e28b2

File tree

6 files changed

+8
-11
lines changed

6 files changed

+8
-11
lines changed

source/code-snippets/indexes/compound.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ async function run() {
3131
const projection = { _id: 0, type: 1, genre: 1 };
3232

3333
// Execute the query using the defined criteria and projection
34-
const cursor = movies
34+
const cursor = await movies
3535
.find(query)
3636
.sort(sort)
3737
.project(projection);

source/code-snippets/indexes/multikey.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ async function run() {
2626
const projection = { _id: 0, cast: 1 , title: 1 };
2727

2828
// Perform a find operation with the preceding filter and projection
29-
const cursor = movies
29+
const cursor = await movies
3030
.find(query)
3131
.project(projection);
3232
// end-query

source/code-snippets/indexes/single-field.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ async function run() {
2525
const sort = { title: 1 };
2626
const projection = { _id: 0, title: 1 };
2727
// Execute the query using the defined parameters
28-
const cursor = movies
28+
const cursor = await movies
2929
.find(query)
3030
.sort(sort)
3131
.project(projection);

source/code-snippets/indexes/text.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,8 @@ async function run() {
3333
const projection = { _id: 0, title: 1 };
3434

3535
// Execute the find operation
36-
const cursor = myColl.find(query).project(projection);
36+
const cursor = await myColl.find(query).project(projection);
3737
// end-query
38-
for await (const doc of cursor) {
39-
console.log(doc);
40-
}
4138
} finally {
4239
await client.close();
4340
}

source/crud/query/geo.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ the ``theaters`` collection using the ``createIndex()`` method:
6666

6767
.. code-block:: javascript
6868

69-
db.theaters.createIndex({location.geo: "2dsphere"});
69+
await db.theaters.createIndex({location.geo: "2dsphere"});
7070

7171
.. _plane:
7272

@@ -94,7 +94,7 @@ the field on the collection. The following snippet creates an index on the
9494

9595
.. code-block:: javascript
9696

97-
db.shipwrecks({coordinates: "2d"});
97+
await db.shipwrecks.createIndex({coordinates: "2d"});
9898

9999
See the
100100
:manual:`{+mdb-server+} manual page on legacy coordinate pairs </geospatial-queries/#legacy-coordinate-pairs>`

source/crud/query/text.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ The following examples use sample data from the ``movies`` collection in the
4141

4242
.. code-block:: javascript
4343

44-
db.movies.createIndex({ title: "text" });
44+
await db.movies.createIndex({ title: "text" });
4545

4646
We use a single field text index for the examples in this guide, but you can
4747
create a compound text index that broadens your text queries to multiple
@@ -50,7 +50,7 @@ fields. The following command creates a text index on two fields in the
5050

5151
.. code-block:: javascript
5252

53-
db.movies.createIndex({ title: "text", plot: "text" });
53+
await db.movies.createIndex({ title: "text", plot: "text" });
5454

5555
.. tip:: Specify Field Weights in a Text Index
5656

0 commit comments

Comments
 (0)