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 2
2
const { MongoClient } = require ( "mongodb" ) ;
3
3
const stream = require ( "stream" ) ;
4
4
5
- // Replace the following with your MongoDB deployment's connection
6
- // string.
5
+ // Replace the following string with your MongoDB deployment's connection string.
7
6
const 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 ) ;
14
9
15
10
async function run ( ) {
16
11
try {
Original file line number Diff line number Diff line change 2
2
const { MongoClient } = require ( "mongodb" ) ;
3
3
const stream = require ( "stream" ) ;
4
4
5
- // Replace the following with your MongoDB deployment's connection
6
- // string.
5
+ // Replace the following string with your MongoDB deployment's connection string.
7
6
const 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 ) ;
14
9
15
10
async function forEachIteration ( collection ) {
16
11
// start foreach cursor example
Original file line number Diff line number Diff line change 1
1
// ignored first line
2
2
const { MongoClient } = require ( "mongodb" ) ;
3
3
4
- // Replace the following with your MongoDB deployment's connection
5
- // string.
4
+ // Replace the following string with your MongoDB deployment's connection string.
6
5
const 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 ) ;
13
8
14
9
function sleep ( ms ) {
15
10
return new Promise ( resolve => setTimeout ( resolve , ms ) ) ;
Original file line number Diff line number Diff line change 1
1
// ignored first line
2
2
const { MongoClient } = require ( "mongodb" ) ;
3
3
4
- // Replace the following with your MongoDB deployment's connection
5
- // string.
4
+ // Replace the following string with your MongoDB deployment's connection string.
6
5
const 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 ) ;
13
8
14
9
async function word ( movies ) {
15
10
// start word text example
Original file line number Diff line number Diff line change 1
1
// ignored first line
2
2
const { MongoClient } = require ( "mongodb" ) ;
3
3
4
- // Replace the following with your MongoDB deployment's connection
5
- // string.
4
+ // Replace the following string with your MongoDB deployment's connection string.
6
5
const 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 ) ;
13
8
14
9
async function proximity ( theaters ) {
15
10
// start proximity geo example
You can’t perform that action at this time.
0 commit comments