@@ -7,11 +7,42 @@ title = "Upgrade Considerations"
7
7
pre = " <i class='fa fa-level-up'></i>"
8
8
+++
9
9
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
15
46
16
47
The main change to the MongoDB Reactive Streams Java Driver 1.12 driver is the removal of the ` Success ` type.
17
48
@@ -21,7 +52,7 @@ Breaking changes are as follows:
21
52
Please note that ` onNext ` will not be called just ` onComplete ` if the operation is successful or ` onError ` if there is an error.
22
53
* Removal of deprecated methods
23
54
24
- ## Upgrading from mongo-scala-driver 2.7
55
+ ## Upgrading from the 2.8 Scala driver
25
56
26
57
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
27
58
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:
35
66
* Removal of deprecated methods
36
67
37
68
38
- ## System Requirements
69
+ # System Requirements
39
70
40
71
The minimum JVM is Java 8.
41
72
42
- ## Compatibility
73
+ # Compatibility
43
74
44
75
The following table specifies the compatibility of the MongoDB Java driver for use with a specific version of MongoDB.
45
76
0 commit comments