File tree Expand file tree Collapse file tree 17 files changed +71
-78
lines changed
code-snippets/usage-examples Expand file tree Collapse file tree 17 files changed +71
-78
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
const { MongoClient } = require ( "mongodb" ) ;
2
2
const fs = require ( "fs" ) ;
3
3
4
- // Replace the following string with your MongoDB deployment's connection string.
4
+ // Replace the uri string with your MongoDB deployment's connection string.
5
5
const uri =
6
- "mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority" ;
6
+ "mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true " ;
7
7
8
- const client = new MongoClient ( uri , { useUnifiedTopology : true } ) ;
8
+ const client = new MongoClient ( uri ) ;
9
9
10
10
async function run ( ) {
11
11
try {
@@ -40,7 +40,7 @@ async function run() {
40
40
console . log ( "Number of documents inserted: " + result . nInserted ) ;
41
41
} else {
42
42
console . log (
43
- "No documents were inserted during the bulk write operation"
43
+ "No documents were inserted during the bulk write operation" ,
44
44
) ;
45
45
}
46
46
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 string with your MongoDB deployment's connection string.
4
+ // Replace the uri string with your MongoDB deployment's connection string.
5
5
const uri =
6
- "mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority" ;
6
+ "mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true " ;
7
7
8
- const client = new MongoClient ( uri , { useUnifiedTopology : true } ) ;
8
+ const client = new MongoClient ( uri ) ;
9
9
10
10
async function run ( ) {
11
11
try {
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 string with your MongoDB deployment's connection string.
4
+ // Replace the uri string with your MongoDB deployment's connection string.
5
5
const uri =
6
- "mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority" ;
6
+ "mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true " ;
7
7
8
- const client = new MongoClient ( uri , { useUnifiedTopology : true } ) ;
8
+ const client = new MongoClient ( uri ) ;
9
9
10
10
async function run ( ) {
11
11
try {
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 string with your MongoDB deployment's connection string.
4
+ // Replace the uri string with your MongoDB deployment's connection string.
5
5
const uri =
6
- "mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority" ;
6
+ "mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true " ;
7
7
8
- const client = new MongoClient ( uri , { useUnifiedTopology : true } ) ;
8
+ const client = new MongoClient ( uri ) ;
9
9
10
10
async function run ( ) {
11
11
try {
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 string with your MongoDB deployment's connection string.
4
+ // Replace the uri string with your MongoDB deployment's connection string.
5
5
const uri =
6
- "mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority" ;
6
+ "mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true " ;
7
7
8
- const client = new MongoClient ( uri , { useUnifiedTopology : true } ) ;
8
+ const client = new MongoClient ( uri ) ;
9
9
10
10
async function run ( ) {
11
11
try {
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 string with your MongoDB deployment's connection string.
4
+ // Replace the uri string with your MongoDB deployment's connection string.
5
5
const uri =
6
- "mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority" ;
6
+ "mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true " ;
7
7
8
- const client = new MongoClient ( uri , { useUnifiedTopology : true } ) ;
8
+ const client = new MongoClient ( uri ) ;
9
9
10
10
async function run ( ) {
11
11
try {
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 string with your MongoDB deployment's connection string.
4
+ // Replace the uri string with your MongoDB deployment's connection string.
5
5
const uri =
6
- "mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority" ;
6
+ "mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true " ;
7
7
8
- const client = new MongoClient ( uri , { useUnifiedTopology : true } ) ;
8
+ const client = new MongoClient ( uri ) ;
9
9
10
10
async function run ( ) {
11
11
try {
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 string with your MongoDB deployment's connection string.
4
+ // Replace the uri string with your MongoDB deployment's connection string.
5
5
const uri =
6
- "mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority" ;
6
+ "mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&w=majority&useUnifiedTopology=true " ;
7
7
8
- const client = new MongoClient ( uri , { useUnifiedTopology : true } ) ;
8
+ const client = new MongoClient ( uri ) ;
9
9
10
10
async function run ( ) {
11
11
try {
You can’t perform that action at this time.
0 commit comments