Skip to content

Commit 6e6cbd4

Browse files
committed
Docs sites: edits to the async driver documentation
1 parent 67adde5 commit 6e6cbd4

File tree

4 files changed

+31
-22
lines changed

4 files changed

+31
-22
lines changed

docs/reference/content/driver-async/reference/connecting/authenticating.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ only available in the MongoDB [Enterprise Edition](http://docs.mongodb.org/manua
1515

1616
An authentication credential is represented as an instance of the
1717
[`MongoCredential`]({{< apiref "com/mongodb/MongoCredential" >}}) class, which includes static factory methods for
18-
each of the supported authentication mechanisms. A list of these instances must be passed to the driver via one of several
19-
[`MongoClient`]({{< apiref "com/mongodb/MongoClient" >}}) constructors that take either a
20-
parameter of type `List<MongoCredential>`. Alternatively, a single [`MongoCredential`]({{< apiref "com/mongodb/MongoCredential" >}})
21-
can be created implicity via a
22-
[`MongoClientURI`]({{< apiref "com/mongodb/MongoClientURI" >}}) and passed to a [`MongoClient`]({{< apiref "com/mongodb/MongoClient" >}})
23-
constructor that takes a `[`MongoClientURI`]({{< apiref "com/mongodb/MongoClientURI" >}}) parameter.
18+
each of the supported authentication mechanisms. A list of these instances must be passed to the driver via a
19+
[`MongoClients`]({{< apiref "com/mongodb/async/client/MongoClients" >}}) static factory method that takes a
20+
[`MongoClientSettings`]({{< apiref "com/mongodb/async/client/MongoClientSettings" >}}) parameter. Alternatively, a single
21+
`MongoCredential` can be created implicity via a
22+
[`ConnectionString`]({{< apiref "com/mongodb/ConnectionString" >}}) and passed to a
23+
`MongoClients` static factory method that takes a `ConnectionString` parameter.
2424

2525
{{% note %}}
2626
Given the flexibility of role-based access control in MongoDB, it is usually sufficient to authenticate with a single user, but, for completeness, the driver accepts a list of credentials.
@@ -50,7 +50,7 @@ MongoCredential credential = MongoCredential.createCredential(user,
5050
or with a connection string:
5151

5252
```java
53-
MongoClientURI uri = new MongoClientURI("mongodb://user1:pwd1@host1/?authSource=db1");
53+
ConnectionString uri = new ConnectionString("mongodb://user1:pwd1@host1/?authSource=db1");
5454
```
5555

5656
This is the recommended approach as it will make upgrading from MongoDB 2.6 to MongoDB 3.0 seamless, even after [upgrading the
@@ -71,7 +71,7 @@ MongoCredential credential = MongoCredential.createScramSha1Credential(user,
7171
or with a connection string:
7272

7373
```java
74-
MongoClientURI uri = new MongoClientURI("mongodb://user1:pwd1@host1/?authSource=db1&authMechanism=SCRAM-SHA-1");
74+
ConnectionString uri = new ConnectionString("mongodb://user1:pwd1@host1/?authSource=db1&authMechanism=SCRAM-SHA-1");
7575
```
7676

7777
## MONGODB-CR
@@ -88,7 +88,7 @@ MongoCredential credential = MongoCredential.createMongoCRCredential(user,
8888
or with a connection string:
8989

9090
```java
91-
MongoClientURI uri = new MongoClientURI("mongodb://user1:pwd1@host1/?authSource=db1&authMechanism=MONGODB-CR");
91+
ConnectionString uri = new ConnectionString("mongodb://user1:pwd1@host1/?authSource=db1&authMechanism=MONGODB-CR");
9292
```
9393

9494
Note that this is not recommended as a credential created in this way will fail to authenticate after an authentication schema upgrade
@@ -109,7 +109,7 @@ MongoCredential credential = MongoCredential.createMongoX509Credential(user);
109109
or with a connection string:
110110

111111
```java
112-
MongoClientURI uri = new MongoClientURI("mongodb://subjectName@host1/?authMechanism=MONGODB-X509");
112+
ConnectionString uri = new ConnectionString("mongodb://subjectName@host1/?authMechanism=MONGODB-X509");
113113
```
114114

115115
See the MongoDB server
@@ -131,7 +131,7 @@ MongoCredential credential = MongoCredential.createGSSAPICredential(user);
131131
or with a connection string:
132132

133133
```java
134-
MongoClientURI uri = new MongoClientURI("mongodb://username%40REALM.com@host1/?authMechanism=GSSAPI");
134+
ConnectionString uri = new ConnectionString("mongodb://username%40REALM.com@host1/?authMechanism=GSSAPI");
135135
```
136136

137137
{{% note %}}
@@ -161,7 +161,7 @@ MongoCredential credential = MongoCredential.createPlainCredential(user, "$exter
161161
or with a connection string:
162162

163163
```java
164-
MongoClientURI uri = new MongoClientURI("mongodb://user1@host1/?authSource=$external&authMechanism=PLAIN");
164+
ConnectionString uri = new ConnectionString("mongodb://user1@host1/?authSource=$external&authMechanism=PLAIN");
165165
```
166166

167167
{{% note %}}

docs/reference/content/driver-async/reference/connecting/connection-settings.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ database component, does not use the database component for anything other than
5252
#### Options
5353

5454
Many options can be provided via the connection string. The ones that cannot may be provided in a
55-
[`MongoClientOptions`]({{< apiref "com/mongodb/MongoClientOptions" >}}) instance. To
55+
[`MongoClientSettings`]({{< apiref "com/mongodb/async/client/MongoClientSettings" >}}) instance. To
5656
provide an option, append a `?` to the connection string and separate options by an `&`.
5757

5858
```ini
@@ -84,7 +84,7 @@ MongoClient client = MongoClients.create(new ConnectionString("mongodb://host:27
8484
```
8585

8686
Finally, the [`MongoClientSettings`]({{< apiref "com/mongodb/async/client/MongoClientSettings" >}}) class provides an in-code way to set the
87-
same options from a connection string. This is sometimes necessary, as the connection string does not allow an application to configure as
87+
same options from a connection string. This is sometimes necessary, as the connection string does not allow an application to configure as
8888
many properties of the connection as `MongoClientSettings`.
8989
[`MongoClientSettings`]({{< apiref "com/mongodb/async/client/MongoClientSettings" >}}) instances are immutable, so to create one an
9090
application uses a builder:

docs/reference/content/driver-async/reference/connecting/ssl.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,38 @@ title = "SSL"
1111
## SSL
1212

1313
The Java driver supports SSL connections to MongoDB servers using the underlying support for SSL provided by the JDK. You can configure
14-
the driver to use SSL either with `MongoClientURI` or with `MongoClientOptions`.
14+
the driver to use SSL either with `ConnectionString` or with `MongoClientSettings`.
1515

16-
With `MongoClientURI`, specify `ssl=true as a query parameter, as in:
16+
With `ConnectionString`, specify `ssl=true as a query parameter, as in:
1717

1818
```java
19-
new MongoClientURI("mongodb://localhost/?ssl=true")
19+
new ConnectionString("mongodb://localhost/?ssl=true")
2020
```
2121

22-
With `MongoClientOptions`, set the sslEnabled property to true, as in:
22+
With `MongoClientSettings`, set the sslEnabled property to true, as in:
2323

2424
```java
25-
MongoClientOptions.builder().sslEnabled(true).build()
25+
MongoClientSettings.builder()
26+
.sslSettings(SslSettings.builder()
27+
.enabled(true)
28+
.build())
29+
.build()
2630
```
2731

2832
### Host name verification
2933

3034
By default, the driver ensures that the host name included in the server's SSL certificate(s) matches the host name(s) provided when
3135
constructing a `MongoClient`. However, this host name verification requires a Java 7 JVM, as it relies on additions to the
3236
`javax.net.SSLParameters` class that were introduced in Java 7. If your application must run on Java 6, or for some other reason you need
33-
to disable host name verification, you must expicitly indicate this in `MongoClientOptions` using the `sslInvalidHostNameAllowed` property:
37+
to disable host name verification, you must expicitly indicate this in `SslSettings` using the `invalidHostNameAllowed` property:
3438

3539
```java
36-
MongoClientOptions.builder().sslEnabled(true).sslInvalidHostNameAllowed(true).build()
40+
MongoClientSettings.builder()
41+
.sslSettings(SslSettings.builder()
42+
.enabled(true)
43+
.invalidHostNameAllowed(true)
44+
.build())
45+
.build()
3746
```
3847

3948
### JVM system properties

docs/reference/content/driver/reference/connecting/authenticating.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ only available in the MongoDB [Enterprise Edition](http://docs.mongodb.org/manua
1616
An authentication credential is represented as an instance of the
1717
[`MongoCredential`]({{< apiref "com/mongodb/MongoCredential" >}}) class, which includes static factory methods for
1818
each of the supported authentication mechanisms. A list of these instances must be passed to the driver via one of several
19-
[`MongoClient`]({{< apiref "com/mongodb/MongoClient" >}}) constructors that take either a
19+
[`MongoClient`]({{< apiref "com/mongodb/MongoClient" >}}) constructors that take a
2020
parameter of type `List<MongoCredential>`. Alternatively, a single [`MongoCredential`]({{< apiref "com/mongodb/MongoCredential" >}})
2121
can be created implicity via a
2222
[`MongoClientURI`]({{< apiref "com/mongodb/MongoClientURI" >}}) and passed to a [`MongoClient`]({{< apiref "com/mongodb/MongoClient" >}})

0 commit comments

Comments
 (0)