File tree Expand file tree Collapse file tree 5 files changed +15
-40
lines changed
source/code-snippets/crud Expand file tree Collapse file tree 5 files changed +15
-40
lines changed Original file line number Diff line number Diff line change 22const { MongoClient } = require ( "mongodb" ) ;
33const stream = require ( "stream" ) ;
44
5- // Replace the following with your MongoDB deployment's connection
6- // string.
5+ // Replace the following string with your MongoDB deployment's connection string.
76const uri =
8- "mongodb+srv://***REMOVED***/test?retryWrites=true&w=majority" ;
9-
10- const client = new MongoClient ( uri , {
11- useNewUrlParser : true ,
12- useUnifiedTopology : true ,
13- } ) ;
7+ "mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true" ;
8+ const client = new MongoClient ( uri ) ;
149
1510async function run ( ) {
1611 try {
Original file line number Diff line number Diff line change 22const { MongoClient } = require ( "mongodb" ) ;
33const stream = require ( "stream" ) ;
44
5- // Replace the following with your MongoDB deployment's connection
6- // string.
5+ // Replace the following string with your MongoDB deployment's connection string.
76const uri =
8- "mongodb+srv://***REMOVED***/test?retryWrites=true&w=majority" ;
9-
10- const client = new MongoClient ( uri , {
11- useNewUrlParser : true ,
12- useUnifiedTopology : true ,
13- } ) ;
7+ "mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true" ;
8+ const client = new MongoClient ( uri ) ;
149
1510async function forEachIteration ( collection ) {
1611 // start foreach cursor example
Original file line number Diff line number Diff line change 11// ignored first line
22const { MongoClient } = require ( "mongodb" ) ;
33
4- // Replace the following with your MongoDB deployment's connection
5- // string.
4+ // Replace the following string with your MongoDB deployment's connection string.
65const uri =
7- "mongodb+srv://***REMOVED***/test?retryWrites=true&w=majority" ;
8-
9- const client = new MongoClient ( uri , {
10- useNewUrlParser : true ,
11- useUnifiedTopology : true ,
12- } ) ;
6+ "mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true" ;
7+ const client = new MongoClient ( uri ) ;
138
149function sleep ( ms ) {
1510 return new Promise ( resolve => setTimeout ( resolve , ms ) ) ;
Original file line number Diff line number Diff line change 11// ignored first line
22const { MongoClient } = require ( "mongodb" ) ;
33
4- // Replace the following with your MongoDB deployment's connection
5- // string.
4+ // Replace the following string with your MongoDB deployment's connection string.
65const uri =
7- "mongodb+srv://***REMOVED***/test?retryWrites=true&w=majority" ;
8-
9- const client = new MongoClient ( uri , {
10- useNewUrlParser : true ,
11- useUnifiedTopology : true ,
12- } ) ;
6+ "mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true" ;
7+ const client = new MongoClient ( uri ) ;
138
149async function word ( movies ) {
1510 // start word text example
Original file line number Diff line number Diff line change 11// ignored first line
22const { MongoClient } = require ( "mongodb" ) ;
33
4- // Replace the following with your MongoDB deployment's connection
5- // string.
4+ // Replace the following string with your MongoDB deployment's connection string.
65const uri =
7- "mongodb+srv://***REMOVED***/test?retryWrites=true&w=majority" ;
8-
9- const client = new MongoClient ( uri , {
10- useNewUrlParser : true ,
11- useUnifiedTopology : true ,
12- } ) ;
6+ "mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true" ;
7+ const client = new MongoClient ( uri ) ;
138
149async function proximity ( theaters ) {
1510 // start proximity geo example
You can’t perform that action at this time.
0 commit comments