File tree Expand file tree Collapse file tree 5 files changed +6
-6
lines changed Expand file tree Collapse file tree 5 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ async function word(movies) {
26
26
// end word text example
27
27
28
28
// print a message if no documents were found
29
- if ( ( await cursor . count ( ) ) == 0 ) {
29
+ if ( ( await cursor . count ( ) ) === 0 ) {
30
30
console . log ( "No documents found!" ) ;
31
31
}
32
32
await cursor . forEach ( console . dir ) ;
@@ -95,7 +95,7 @@ async function relevance(movies) {
95
95
// end relevance text example
96
96
97
97
// print a message if no documents were found
98
- if ( ( await cursor . count ( ) ) == 0 ) {
98
+ if ( ( await cursor . count ( ) ) === 0 ) {
99
99
console . log ( "No documents found!" ) ;
100
100
}
101
101
await cursor . forEach ( console . dir ) ;
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ async function range(theaters) {
58
58
// end range geo example
59
59
60
60
// print a message if no documents were found
61
- if ( ( await cursor . count ( ) ) == 0 ) {
61
+ if ( ( await cursor . count ( ) ) === 0 ) {
62
62
console . log ( "No documents found!" ) ;
63
63
}
64
64
await cursor . forEach ( console . dir ) ;
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ async function run() {
32
32
. project ( projection ) ;
33
33
34
34
// print a message if no documents were found
35
- if ( ! ( await cursor . hasNext ( ) ) ) {
35
+ if ( ( await cursor . count ( ) ) === 0 ) {
36
36
console . log ( "No documents found!" ) ;
37
37
}
38
38
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ async function run() {
21
21
const docs = [ docOne , docTwo , docThree ] ;
22
22
// specify an additional options object
23
23
const options = { } ;
24
- options . ordered = true ; // prevent additional documents from being prevented if one fails
24
+ options . ordered = true ; // prevent additional documents from being inserted if one fails
25
25
const result = await collection . insertMany ( docs , options ) ;
26
26
console . log ( `${ result . insertedCount } documents were inserted` ) ;
27
27
} finally {
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ async function run() {
12
12
13
13
const database = client . db ( "sample_mflix" ) ;
14
14
const collection = database . collection ( "movies" ) ;
15
- // create a document object
15
+ // create a document to be inserted
16
16
const doc = { name : "Red" , town : "kanto" } ;
17
17
const result = await collection . insertOne ( doc ) ;
18
18
You can’t perform that action at this time.
0 commit comments