Skip to content

Commit ea64e17

Browse files
committed
Use tls property over ssl
- use `tls: true` for likelihood of ssl: true being removed - confirm tls is enabled by mongodb+srv:// https://www.mongodb.com/docs/manual/reference/connection-string/
1 parent d7dd6c0 commit ea64e17

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/tutorials/ssl.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# TLS/SSL Connections
22

3-
Mongoose supports connecting to [MongoDB clusters that require TLS/SSL connections](https://www.mongodb.com/docs/manual/tutorial/configure-ssl/). Setting the either the `tls` or `ssl` option to `true` in [`mongoose.connect()`](../api/mongoose.html#mongoose_Mongoose-connect) or your connection string is enough to connect to a MongoDB cluster using TLS/SSL:
3+
Mongoose supports connecting to [MongoDB clusters that require TLS/SSL connections](https://www.mongodb.com/docs/manual/tutorial/configure-ssl/). Setting the `tls` option to `true` in [`mongoose.connect()`](../api/mongoose.html#mongoose_Mongoose-connect) or your connection string is enough to connect to a MongoDB cluster using TLS/SSL:
44

55
```javascript
6-
mongoose.connect('mongodb://127.0.0.1:27017/test', { ssl: true });
6+
mongoose.connect('mongodb://127.0.0.1:27017/test', { tls: true });
77

88
// Equivalent:
9-
mongoose.connect('mongodb://127.0.0.1:27017/test?ssl=true');
9+
mongoose.connect('mongodb://127.0.0.1:27017/test?tls=true');
1010
```
1111

12-
The `ssl` option defaults to `false` for connection strings that start with `mongodb://`. However,
13-
the `ssl` option defaults to `true` for connection strings that start with `mongodb+srv://`. So if you are using an srv connection string to connect to [MongoDB Atlas](https://www.mongodb.com/cloud/atlas), SSL is enabled by default.
12+
The `tls` option defaults to `false` for connection strings that start with `mongodb://`. However,
13+
the `tls` option defaults to `true` for connection strings that start with `mongodb+srv://`. So if you are using an srv connection string to connect to [MongoDB Atlas](https://www.mongodb.com/cloud/atlas), TLS/SSL is enabled by default.
1414

1515
If you try to connect to a MongoDB cluster that requires TLS/SSL without enabling the `tls`/`ssl` option, `mongoose.connect()` will error out with the below error:
1616

0 commit comments

Comments
 (0)