File tree Expand file tree Collapse file tree 6 files changed +8
-11
lines changed
Expand file tree Collapse file tree 6 files changed +8
-11
lines changed Original file line number Diff line number Diff 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 ) ;
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 ) ;
Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff 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
9999See the
100100:manual:`{+mdb-server+} manual page on legacy coordinate pairs </geospatial-queries/#legacy-coordinate-pairs>`
Original file line number Diff line number Diff 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
4646We use a single field text index for the examples in this guide, but you can
4747create 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
You can’t perform that action at this time.
0 commit comments