Skip to content

Commit a3e4e32

Browse files
committed
Restore line lengths fixed by prettier
1 parent 1359c44 commit a3e4e32

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

docs/tutorials/ssl.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,11 @@ If you're using [X.509 authentication](https://www.mongodb.com/docs/drivers/node
7272
```javascript
7373
// Do this:
7474
const username = 'myusername';
75-
await mongoose.connect(
76-
`mongodb://${encodeURIComponent(username)}@127.0.0.1:27017/test`,
77-
{
78-
tls: true,
79-
tlsCAFile: `${__dirname}/rootCA.pem`,
80-
authMechanism: 'MONGODB-X509',
81-
}
82-
);
75+
await mongoose.connect(`mongodb://${encodeURIComponent(username)}@127.0.0.1:27017/test`, {
76+
tls: true,
77+
tlsCAFile: `${__dirname}/rootCA.pem`,
78+
authMechanism: 'MONGODB-X509',
79+
});
8380

8481
// Not this:
8582
await mongoose.connect('mongodb://127.0.0.1:27017/test', {
@@ -101,11 +98,10 @@ MongoServerSelectionError: unable to get local issuer certificate
10198
To connect to a MongoDB Atlas cluster using X.509 authentication the correct option to set is `tlsCertificateKeyFile`. The connection string already specifies the `authSource` and `authMechanism`, however they're included below as `connect()` options for completeness:
10299

103100
```javascript
104-
const url =
105-
'mongodb+srv://xyz.mongodb.net/test?authSource=%24external&authMechanism=MONGODB-X509';
101+
const url = 'mongodb+srv://xyz.mongodb.net/test?authSource=%24external&authMechanism=MONGODB-X509';
106102
await mongoose.connect(url, {
107103
tls: true,
108-
// location of a local .pem file that contains both the client's certificate and key, e.g.
104+
// location of a local .pem file that contains both the client's certificate and key
109105
tlsCertificateKeyFile: '/path/to/certificate.pem',
110106
authMechanism: 'MONGODB-X509',
111107
authSource: '$external',

0 commit comments

Comments
 (0)