Skip to content

Commit 806813c

Browse files
committed
Add 4.0 Upgrading Guide
JAVA-3534
1 parent cb7ad51 commit 806813c

File tree

2 files changed

+45
-9
lines changed

2 files changed

+45
-9
lines changed

docs/reference/content/upgrading.md

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,42 @@ title = "Upgrade Considerations"
77
pre = "<i class='fa fa-level-up'></i>"
88
+++
99

10-
## Upgrading from 3.x
11-
12-
... TODO ...
13-
14-
## Upgrading from mongo-java-driver-reactivestreams 1.12
10+
# Upgrading to the 4.0 Driver
11+
12+
## Upgrading from the 3.12 Java driver
13+
14+
The 4.0 release is a major release as per the definition of semantic versioning included in [semver.org]. As such, users
15+
that upgrade to this release should expect breaking changes. That said, we have attempted to ensure that the upgrade
16+
process is as seamless as possible. Breaking changes are as follows:
17+
18+
* Numerous classes and methods have been removed from the driver. All of these API elements are annotated as deprecated in the
19+
3.12 release, so if you compile your application with 3.12 and enable deprecation warnings in the compiler, you will be
20+
able to locate all uses of these API elements and follow the recommendations contained in the Javadoc for each API element
21+
to remove usage from your application. Most of these API elements are unlikely to be used by normal applications, but one bears
22+
mentioning explicitly: the entire callback-baked asynchronous driver has been removed. Applications relying on this driver must either
23+
port their application to the Reactive Streams driver, or else must remain on a 3.x driver release.
24+
* While the `com.mongodb.MongoClient#getDB` method is deprecated in 3.x drivers, it has not been removed in this release. It will remain
25+
at least until the next major release cycle.
26+
* The insert helper methods now return an insert result object instead of void.
27+
* The various `toJson` methods on `BsonDocument`, `Document`, and `DBObject` now return "relaxed" JSON instead of "strict" JSON. This
28+
creates more readable JSON documents at the cost of a loss of some BSON type information (e.g., differentiating between 32 and 64 bit
29+
integers).
30+
* The default BSON representation of `java.util.UUID` values has changed from `JAVA_LEGACY` to `UNSPECIFIED`. Applications that
31+
store or retrieve UUID values must explicitly specify which representation to use, via the `uuidRepresentation` property of
32+
`MongoClientSettings` (or `MongoClientOptions` for the legacy driver).
33+
* The connection pool no longer enforces any restrictions on the size of the wait queue of threads or asynchronous tasks that
34+
require a connection to MongoDB. It is up to the application to throttle requests sufficiently rather than rely on the driver to
35+
throw a `MongoWaitQueueFullException`.
36+
* The driver no longer logs via JUL (`java.util.logging`). The only supported logging framework is SLF4J.
37+
* The embedded and Android drivers have been removed. Applications relying on these drivers must remain on a 3.x driver release.
38+
* The `mongo-java-driver` and `mongodb-driver` "uber-jars" are no longer published. Applications that reference either of these artifacts
39+
must switch to either `mongodb-driver-sync` or `mongodb-driver-legacy`, depending on which API is being used. Care should be taken to
40+
ensure that neither of the uber-jars are included via a transitive dependency, as that could introduce versioning conflicts.
41+
* Java 8 is now the minimum supported version. Applications using older versions of Java must remain on a 3.x driver release.
42+
* Several binary compatibility breaks were introduced (in particular, the change to the signature of the insert helper methods), so any
43+
classes that link to the driver must be recompiled in order to work with this release.
44+
45+
## Upgrading from the 1.12 Reactive Streams driver
1546

1647
The main change to the MongoDB Reactive Streams Java Driver 1.12 driver is the removal of the `Success` type.
1748

@@ -21,7 +52,7 @@ Breaking changes are as follows:
2152
Please note that `onNext` will not be called just `onComplete` if the operation is successful or `onError` if there is an error.
2253
* Removal of deprecated methods
2354

24-
## Upgrading from mongo-scala-driver 2.7
55+
## Upgrading from the 2.8 Scala driver
2556

2657
As the mongodb-driver-async package was deprecated in 3.x. The 4.0 version of the MongoDB Scala Driver is now built upon the
2758
mongo-java-driver-reactivestreams 4.0 driver. One major benefit is now the Scala driver is also a reactive streams driver.
@@ -35,11 +66,11 @@ Breaking changes are as follows:
3566
* Removal of deprecated methods
3667

3768

38-
## System Requirements
69+
# System Requirements
3970

4071
The minimum JVM is Java 8.
4172

42-
## Compatibility
73+
# Compatibility
4374

4475
The following table specifies the compatibility of the MongoDB Java driver for use with a specific version of MongoDB.
4576

docs/reference/content/whats-new.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ title = "What's New"
77
pre = "<i class='fa fa-level-up'></i>"
88
+++
99

10-
## What's new in 3.12
10+
# What's new in 4.0
11+
12+
This release adds no new features but, as a major release, contains breaking changes that may affect your application. Please consult the
13+
[Upgrading Guide]({{<ref "upgrading.md">}}) for an enumeration of the breaking changes.
14+
15+
# What's new in 3.12
1116

1217
This release fully supports all MongoDB releases from versions 2.6 to 4.2. Key new features of the 3.12 Java driver release include:
1318

0 commit comments

Comments
 (0)