Skip to content

Commit 4fd3973

Browse files
committed
Update reference documentation for the 3.5 release
1 parent 89193c9 commit 4fd3973

File tree

12 files changed

+239
-39
lines changed

12 files changed

+239
-39
lines changed

docs/reference/content/bson/installation-guide.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ This library comprehensively supports [BSON](http://www.bsonspec.org),
2222
the data storage and network transfer format that MongoDB uses for "documents".
2323
BSON is short for Binary [JSON](http://json.org/), is a binary-encoded serialization of JSON-like documents.
2424

25-
{{< install artifactId="bson" version="3.4.2" >}}
25+
{{< install artifactId="bson" version="3.5.0" >}}

docs/reference/content/driver-async/getting-started/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ The MongoDB Async Driver requires either [Netty](http://netty.io/) or Java 7.
2323

2424
The MongoDB Async Driver provides asynchronous API that can leverage either Netty or Java 7's AsynchronousSocketChannel for fast and non-blocking I/O.
2525

26-
{{< install artifactId="mongodb-driver-async" version="3.5.0-SNAPSHOT" dependencies="true">}}
26+
{{< install artifactId="mongodb-driver-async" version="3.5.0" dependencies="true">}}

docs/reference/content/driver-async/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ title = "MongoDB Async Driver"
99

1010
## MongoDB Async Java Driver Documentation
1111

12-
The following guide provides information on using the callback-based MongoDB Async Java Driver 3.4.
12+
The following guide provides information on using the callback-based MongoDB Async Java Driver 3.5.
1313

1414
{{% note %}}
1515
There are two higher level MongoDB Asynchronous Java Drivers available, that users may find easier to work with due to their friendlier APIs:

docs/reference/content/driver-async/reference/monitoring.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,78 @@ and when that MongoClient is closed. In addition, it will print a message when
182182
* without an available server that will accept writes
183183
* with an available server that will accept reads using the configured `ReadPreference`
184184
* without an available server that will accept reads using the configured `ReadPreference`
185+
186+
# Connection Pool Monitoring
187+
188+
The driver supports monitoring of connection pool-related events.
189+
190+
An application registers listeners with a `MongoClient` by configuring `MongoClientSettings` with instances of classes that
191+
implement the [`ConnectionPoolListener`]({{< apiref "com/mongodb/event/ConnectionPoolListener" >}}) interface.
192+
193+
Consider the following, simplistic, example of a connection pool listener:
194+
195+
```java
196+
public class TestConnectionPoolListener implements ConnectionPoolListener {
197+
@Override
198+
public void connectionPoolOpened(final ConnectionPoolOpenedEvent event) {
199+
System.out.println(event);
200+
}
201+
202+
@Override
203+
public void connectionPoolClosed(final ConnectionPoolClosedEvent event) {
204+
System.out.println(event);
205+
}
206+
207+
@Override
208+
public void connectionCheckedOut(final ConnectionCheckedOutEvent event) {
209+
System.out.println(event);
210+
}
211+
212+
@Override
213+
public void connectionCheckedIn(final ConnectionCheckedInEvent event) {
214+
System.out.println(event);
215+
}
216+
217+
@Override
218+
public void waitQueueEntered(final ConnectionPoolWaitQueueEnteredEvent event) {
219+
System.out.println(event);
220+
}
221+
222+
@Override
223+
public void waitQueueExited(final ConnectionPoolWaitQueueExitedEvent event) {
224+
System.out.println(event);
225+
}
226+
227+
@Override
228+
public void connectionAdded(final ConnectionAddedEvent event) {
229+
System.out.println(event);
230+
}
231+
232+
@Override
233+
public void connectionRemoved(final ConnectionRemovedEvent event) {
234+
System.out.println(event);
235+
}
236+
}
237+
```
238+
239+
and an instance of `MongoClientSettings` configured with an instance of `TestConnectionPoolListener`:
240+
241+
```java
242+
List<ServerAddress> seedList = ...
243+
TestConnectionPoolListener connectionPoolListener = new TestConnectionPoolListener();
244+
ClusterSettings clusterSettings = ClusterSettings.builder()
245+
.hosts(seedList)
246+
.build();
247+
ConnectionPoolSettings connectionPoolSettings =
248+
ConnectionPoolSettings.builder()
249+
.addConnectionPoolListener(connectionPoolListener)
250+
.build();
251+
MongoClientSettings settings = MongoClientSettings.builder()
252+
.clusterSettings(clusterSettings)
253+
.connectionPoolSettings(connectionPoolSettings)
254+
.build();
255+
MongoClient client = MongoClients.create(settings);
256+
```
257+
258+
A `MongoClient` configured with these options will print a message to `System.out` for each connection pool-related event for each MongoDB
259+
server to which the MongoClient is connected.

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ To use TLS/SSL, you must configure the asynchronous driver to use [Netty](http:/
1919

2020
{{% note %}}
2121
If your application requires Netty, it must explicitly add a dependency to
22-
Netty artifacts. The driver is currently tested against Netty 4.0.
22+
Netty artifacts. The driver is currently tested against Netty 4.1.
2323
{{% /note %}}
2424

2525
### Via Connection String
@@ -36,7 +36,9 @@ You can also specify the connection string via the [`ConnectionString`]({{< apir
3636

3737
### Via `MongoClientSettings`
3838

39-
To specify TLS/SSL with [`MongoClientSettings`]({{< apiref "com/mongodb/async/client/MongoClientSettings.Builder.html#streamFactoryFactory-com.mongodb.connection.StreamFactoryFactory-">}}) , set the ``sslEnabled`` property to ``true``, and the stream factory to [`NettyStreamFactoryFactory`]({{< apiref "com/mongodb/connection/netty/NettyStreamFactoryFactory" >}}), as in
39+
To specify TLS/SSL with [`MongoClientSettings`]({{< apiref "com/mongodb/async/client/MongoClientSettings.Builder.html#streamFactoryFactory-com.mongodb.connection.StreamFactoryFactory-">}}) ,
40+
set the ``sslEnabled`` property to ``true``, and the stream factory to
41+
[`NettyStreamFactoryFactory`]({{< apiref "com/mongodb/connection/netty/NettyStreamFactoryFactory" >}}), as in
4042

4143
```java
4244

@@ -65,6 +67,18 @@ Netty may also be configured by setting the `org.mongodb.async.type` system prop
6567
deprecated as of the 3.1 driver release.
6668
{{% /note %}}
6769

70+
To override the default [`javax.net.ssl.SSLContext`](https://docs.oracle.com/javase/8/docs/api/javax/net/ssl/SSLContext.html) used for SSL
71+
connections, set the `sslContext` property on the `SslSettings`, as in:
72+
73+
```java
74+
SSLContext sslContext = ...
75+
SslSettings sslSettings = SslSettings.builder()
76+
.enabled(true)
77+
.sslContext(sslContext)
78+
.build();
79+
// Pass sslSettings to the MongoClientSettings.Builder
80+
```
81+
6882

6983
## Disable Hostname Verification
7084

docs/reference/content/driver/getting-started/installation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ title = "Installation"
1313
The recommended way to get started using one of the drivers in your
1414
project is with a dependency management system.
1515

16-
There are two Maven artifacts available in the 3.4 release. The preferred artifact for new applications is `mongodb-driver`
16+
There are two Maven artifacts available in the 3.5 release. The preferred artifact for new applications is `mongodb-driver`
1717
however, we still publish the legacy `mongo-java-driver` uber-jar.
1818

1919
{{< distroPicker >}}
@@ -29,7 +29,7 @@ For OSGi-based applications, use the [mongo-java-driver](#uber-jar-legacy) uber
2929

3030
{{% /note %}}
3131

32-
{{< install artifactId="mongodb-driver" version="3.5.0-SNAPSHOT" dependencies="true">}}
32+
{{< install artifactId="mongodb-driver" version="3.5.0" dependencies="true">}}
3333

3434

3535
## Uber Jar (Legacy)
@@ -41,4 +41,4 @@ For new applications, the preferred artifact is [mongodb-driver](#mongodb-driver
4141
The `mongo-java-driver` artifact is a valid OSGi bundle.
4242
{{% /note %}}
4343

44-
{{< install artifactId="mongo-java-driver" version="3.5.0-SNAPSHOT">}}
44+
{{< install artifactId="mongo-java-driver" version="3.5.0">}}

docs/reference/content/driver/reference/monitoring.md

Lines changed: 75 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,13 @@ public class TestCommandListener implements CommandListener {
8484
```
8585

8686

87-
and an instance of `MongoClientSettings` configured with an instance of `TestCommandListener`:
87+
and an instance of `MongoClientOptions` configured with an instance of `TestCommandListener`:
8888

8989
```java
90-
ClusterSettings clusterSettings = ...
91-
MongoClientSettings settings = MongoClientSettings.builder()
92-
.clusterSettings(clusterSettings)
90+
MongoClientOptions options = MongoClientOptions.builder()
9391
.addCommandListener(new TestCommandListener())
9492
.build();
95-
MongoClient client = MongoClients.create(settings);
93+
MongoClient client = new MongoClient(new ServerAddress(), options);
9694
```
9795

9896
A `MongoClient` configured with these options will print a message to `System.out` before sending each command to a MongoDB server, and
@@ -104,7 +102,7 @@ The driver implements the
104102
[SDAM Monitoring specification](https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring-monitoring.rst),
105103
allowing an application to be notified when the driver detects changes to the topology of the MongoDB cluster to which it is connected.
106104

107-
An application registers listeners with a `MongoClient` by configuring `MongoClientSettings` with instances of classes that
105+
An application registers listeners with a `MongoClient` by configuring `MongoClientOptions` with instances of classes that
108106
implement any of the [`ClusterListener`]({{< apiref "com/mongodb/event/ClusterListener" >}}),
109107
[`ServerListener`]({{< apiref "com/mongodb/event/ServerListener" >}}),
110108
or [`ServerMonitorListener`]({{< apiref "com/mongodb/event/ServerMonitorListener" >}}) interfaces.
@@ -162,24 +160,86 @@ public class TestClusterListener implements ClusterListener {
162160
}
163161
```
164162

165-
and an instance of `MongoClientSettings` configured with an instance of `TestClusterListener`:
163+
and an instance of `MongoClientOptions` configured with an instance of `TestClusterListener`:
166164

167165
```java
168166
List<ServerAddress> seedList = ...
169-
ClusterSettings clusterSettings = ClusterSettings.builder()
170-
.hosts(seedList)
171-
.addClusterListener(new TestClusterListener(ReadPreference.secondary()))
172-
.build();
173-
MongoClientSettings settings = MongoClientSettings.builder()
174-
.clusterSettings(clusterSettings)
167+
MongoClientOptions options = MongoClientOptions.builder()
168+
.addClusterListener(new TestClusterListener(ReadPreference.secondary()))
175169
.build();
176-
MongoClient client = MongoClients.create(settings);
170+
MongoClient client = new MongoClient(seedList, options);
177171
```
178172

179-
A `MongoClient` configured with these settings will print a message to `System.out` when the MongoClient is created with these options,
173+
A `MongoClient` configured with these options will print a message to `System.out` when the MongoClient is created with these options,
180174
and when that MongoClient is closed. In addition, it will print a message when the client enters a state:
181175

182176
* with an available server that will accept writes
183177
* without an available server that will accept writes
184178
* with an available server that will accept reads using the configured `ReadPreference`
185179
* without an available server that will accept reads using the configured `ReadPreference`
180+
181+
# Connection Pool Monitoring
182+
183+
The driver supports monitoring of connection pool-related events.
184+
185+
An application registers listeners with a `MongoClient` by configuring `MongoClientOptions` with instances of classes that
186+
implement the [`ConnectionPoolListener`]({{< apiref "com/mongodb/event/ConnectionPoolListener" >}}) interface.
187+
188+
Consider the following, simplistic, example of a connection pool listener:
189+
190+
```java
191+
public class TestConnectionPoolListener implements ConnectionPoolListener {
192+
@Override
193+
public void connectionPoolOpened(final ConnectionPoolOpenedEvent event) {
194+
System.out.println(event);
195+
}
196+
197+
@Override
198+
public void connectionPoolClosed(final ConnectionPoolClosedEvent event) {
199+
System.out.println(event);
200+
}
201+
202+
@Override
203+
public void connectionCheckedOut(final ConnectionCheckedOutEvent event) {
204+
System.out.println(event);
205+
}
206+
207+
@Override
208+
public void connectionCheckedIn(final ConnectionCheckedInEvent event) {
209+
System.out.println(event);
210+
}
211+
212+
@Override
213+
public void waitQueueEntered(final ConnectionPoolWaitQueueEnteredEvent event) {
214+
System.out.println(event);
215+
}
216+
217+
@Override
218+
public void waitQueueExited(final ConnectionPoolWaitQueueExitedEvent event) {
219+
System.out.println(event);
220+
}
221+
222+
@Override
223+
public void connectionAdded(final ConnectionAddedEvent event) {
224+
System.out.println(event);
225+
}
226+
227+
@Override
228+
public void connectionRemoved(final ConnectionRemovedEvent event) {
229+
System.out.println(event);
230+
}
231+
}
232+
```
233+
234+
and an instance of `MongoClientOptions` configured with an instance of `TestConnectionPoolListener`:
235+
236+
```java
237+
List<ServerAddress> seedList = ...
238+
MongoClientOptions options = MongoClientOptions.builder()
239+
.addConnectionPoolListener(new TestConnectionPoolListener())
240+
.build();
241+
MongoClient client = new MongoClient(new ServerAddress(), options);
242+
```
243+
244+
A `MongoClient` configured with these options will print a message to `System.out` for each connection pool-related event for each MongoDB
245+
server to which the MongoClient is connected.

docs/reference/content/driver/tutorials/jndi.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The configuration of the `MongoClientFactory` differs depending on the applicati
2828

2929
<module xmlns="urn:jboss:module:1.3" name="org.mongodb">
3030
<resources>
31-
<resource-root path="mongo-java-driver-3.4.2.jar"/>
31+
<resource-root path="mongo-java-driver-3.5.0.jar"/>
3232
</resources>
3333
<dependencies>
3434
<module name="javax.api"/>

docs/reference/content/driver/tutorials/ssl.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,33 @@ MongoClient mongoClient = new MongoClient(uri);
3535
import com.mongodb.MongoClientOptions;
3636
```
3737

38-
To specify TLS/SSL with with [`MongoClientOptions`]({{<apiref "com/mongodb/MongoClientOptions">}}), set the ``sslEnabled`` property to ``true``, as in:
38+
To specify TLS/SSL with with [`MongoClientOptions`]({{<apiref "com/mongodb/MongoClientOptions">}}), set the `sslEnabled` property to `true`, as in:
3939

4040
```java
4141
MongoClientOptions options = MongoClientOptions.builder().sslEnabled(true).build();
4242
MongoClient client = new MongoClient("localhost", options);
4343
```
4444

45+
## Specify `SSLContext` via `MongoClientOptions`
46+
47+
```java
48+
import javax.net.ssl.SSLContext;
49+
import com.mongodb.MongoClientOptions;
50+
import com.mongodb.MongoClient;
51+
```
52+
53+
To specify the [`javax.net.ssl.SSLContext`](https://docs.oracle.com/javase/8/docs/api/javax/net/ssl/SSLContext.html) with
54+
[`MongoClientOptions`]({{<apiref "com/mongodb/MongoClientOptions">}}), set the `sslContext` property, as in:
55+
56+
```java
57+
SSLContext sslContext = ...
58+
MongoClientOptions options = MongoClientOptions.builder()
59+
.sslEnabled(true)
60+
.sslContext(sslContext)
61+
.build();
62+
MongoClient client = new MongoClient("localhost", options);
63+
```
64+
4565
## Disable Hostname Verification
4666

4767
By default, the driver ensures that the hostname included in the

docs/reference/content/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ type = "index"
66

77
## MongoDB Java Driver Documentation
88

9-
Welcome to the MongoDB Java driver documentation hub for the 3.4 driver release.
9+
Welcome to the MongoDB Java driver documentation hub for the 3.5 driver release.
1010

1111

12-
### What's New in 3.4
12+
### What's New in 3.5
1313

14-
For key new features of 3.4, see [What's New]({{< relref "whats-new.md" >}}).
14+
For key new features of 3.5, see [What's New]({{< relref "whats-new.md" >}}).
1515

1616
### Upgrade
1717

docs/reference/content/upgrading.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,15 @@
22
date = "2015-03-19T12:53:39-04:00"
33
title = "Upgrade Considerations"
44
[menu.main]
5-
identifier = "Upgrading to 3.4"
5+
identifier = "Upgrading to 3.5"
66
weight = 80
77
pre = "<i class='fa fa-level-up'></i>"
88
+++
99

10-
## Upgrading from 3.3.x
10+
## Upgrading from 3.4.x
1111

12-
There is one breaking API change in the 3.4 release: due to the addition of a new BSON type for 128-bit decimal values, a new method
13-
had to be added to the BSONCallback({{< apiref "org/bson/BSONCallback.html">}}) interface. Any clients that directly implement that
14-
interface must add an implementation of the new method in order to be compatible with the 3.4 driver.
15-
16-
Otherwise, the 3.4 release is binary and source compatible with the 3.3 release, except for methods that have been added to interfaces that
17-
have been marked as unstable.
12+
The 3.5 release is binary and source compatible with the 3.4 release, except for methods that have been added to interfaces that
13+
have been marked as unstable, and changes to classes or interfaces that have been marked as internal or annotated as Beta.
1814

1915
## Upgrading from 2.x
2016

@@ -36,6 +32,7 @@ The following table specifies the compatibility of the MongoDB Java driver for u
3632

3733
|Java Driver Version|MongoDB 2.6|MongoDB 3.0 |MongoDB 3.2|MongoDB 3.4|
3834
|-------------------|-----------|------------|-----------|-----------|
35+
|Version 3.5 |||||
3936
|Version 3.4 |||||
4037
|Version 3.3 |||| |
4138
|Version 3.2 |||| |
@@ -46,6 +43,7 @@ The following table specifies the compatibility of the MongoDB Java driver for u
4643

4744
|Java Driver Version|Java 5 | Java 6 | Java 7 | Java 8 |
4845
|-------------------|-------|--------|--------|--------|
46+
|Version 3.5 | ||||
4947
|Version 3.4 | ||||
5048
|Version 3.3 | ||||
5149
|Version 3.2 | ||||

0 commit comments

Comments
 (0)