File tree Expand file tree Collapse file tree 6 files changed +11
-11
lines changed
code-snippets/authentication Expand file tree Collapse file tree 6 files changed +11
-11
lines changed Original file line number Diff line number Diff line change 11const { MongoClient } = require ( "mongodb" ) ;
22
33// Replace the following with values for your environment.
4- const username = encodeURIComponent ( "<username >" ) ;
5- const password = encodeURIComponent ( "<password >" ) ;
4+ const username = encodeURIComponent ( "<db_username >" ) ;
5+ const password = encodeURIComponent ( "<db_password >" ) ;
66const clusterUrl = "<MongoDB cluster url>" ;
77
88// Replace the following with your MongoDB deployment's connection string.
Original file line number Diff line number Diff line change 11const { MongoClient } = require ( "mongodb" ) ;
22
33// Replace the following with values for your environment.
4- const username = encodeURIComponent ( "<username >" ) ;
5- const password = encodeURIComponent ( "<password >" ) ;
4+ const username = encodeURIComponent ( "<db_username >" ) ;
5+ const password = encodeURIComponent ( "<db_password >" ) ;
66const clusterUrl = "<MongoDB cluster url>" ;
77
88const authMechanism = "DEFAULT" ;
Original file line number Diff line number Diff line change 11const { MongoClient } = require ( "mongodb" ) ;
22
33// Replace the following with values for your environment.
4- const username = encodeURIComponent ( "<username >" ) ;
5- const password = encodeURIComponent ( "<password >" ) ;
4+ const username = encodeURIComponent ( "<db_username >" ) ;
5+ const password = encodeURIComponent ( "<db_password >" ) ;
66const clusterUrl = "<MongoDB cluster url>" ;
77
88const authMechanism = "SCRAM-SHA-1" ;
Original file line number Diff line number Diff line change 11const { MongoClient } = require ( "mongodb" ) ;
22
33// Replace the following with values for your environment.
4- const username = encodeURIComponent ( "<username >" ) ;
5- const password = encodeURIComponent ( "<password >" ) ;
4+ const username = encodeURIComponent ( "<db_username >" ) ;
5+ const password = encodeURIComponent ( "<db_password >" ) ;
66const clusterUrl = "<MongoDB cluster url>" ;
77
88const authMechanism = "SCRAM-SHA-256" ;
Original file line number Diff line number Diff line change @@ -215,7 +215,7 @@ database:
215215 :copyable: true
216216
217217 const { MongoClient } = require("mongodb");
218- const uri = "mongodb://<username >:<password >@<hostname>:<port>/?authSource=users";
218+ const uri = "mongodb://<db_username >:<db_password >@<hostname>:<port>/?authSource=users";
219219 const client = new MongoClient(uri);
220220
221221You can check if this is the issue by attempting to connect to a MongoDB
Original file line number Diff line number Diff line change @@ -1259,9 +1259,9 @@ Authentication
12591259
12601260 .. code-block:: js
12611261
1262- new MongoClient("mongodb://username:password @<host><port>")
1262+ new MongoClient("mongodb://<db_username>:<db_password> @<host><port>")
12631263 // or
1264- new MongoClient(url, { auth: { username: "<>", password: "<>" } })
1264+ new MongoClient(url, { auth: { username: "<db_username >", password: "<db_password >" } })
12651265
12661266``GridStore`` Removal
12671267`````````````````````
You can’t perform that action at this time.
0 commit comments