Compatibility
Connect to a Compatible MongoDB Deployment
You can use the Java driver to connect to deployments hosted in the following environments:
MongoDB Atlas: the fully managed service for MongoDB deployments in the cloud
MongoDB Enterprise: the subscription-based, self-managed version of MongoDB
MongoDB Community: the source-available, free-to-use, and self-managed version of MongoDB
MongoDB Compatibility
The following compatibility table specifies the recommended version or versions of the MongoDB Java Driver for use with a specific version of MongoDB.
The first column lists the driver version.
Important
MongoDB ensures compatibility between the MongoDB Server and the drivers for three years after the server version's end of life (EOL) date. To learn more about the MongoDB release and EOL dates, see MongoDB Software Lifecycle Schedules.
Java Driver Version | MongoDB 8.1 | MongoDB 8.0 | MongoDB 7.0 | MongoDB 6.1 | MongoDB 6.0 | MongoDB 5.0 | MongoDB 4.4 | MongoDB 4.2 | MongoDB 4.0 | MongoDB 3.6 |
---|---|---|---|---|---|---|---|---|---|---|
5.5 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||
5.2 to 5.4 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
4.10 to 5.1 | ⊛ | ⊛ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
4.8 to 4.9 | ⊛ | ⊛ | ⊛ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
4.7 | ⊛ | ⊛ | ⊛ | ⊛ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
4.3 to 4.6 | ⊛ | ⊛ | ⊛ | ⊛ | ⊛ | ✓ | ✓ | ✓ | ✓ | ✓ |
4.1 to 4.2 | ⊛ | ⊛ | ⊛ | ⊛ | ⊛ | ⊛ | ✓ | ✓ | ✓ | ✓ |
4.0 | ⊛ | ⊛ | ⊛ | ⊛ | ⊛ | ⊛ | ⊛ | ✓ | ✓ | ✓ |
3.11 to 3.12 | ✗ [1] | ⊛ | ⊛ | ⊛ | ⊛ | ⊛ | ⊛ | ✓ | ✓ | ✓ |
3.8 to 3.10 | ✗ [1] | ⊛ | ⊛ | ⊛ | ⊛ | ⊛ | ⊛ | ⊛ | ✓ | ✓ |
[1] | (1, 2) These driver versions are not compatible with MongoDB 8.1 or later because of an authentication issue. To learn more, see Server Version 8.1 Support Changes. |
Language Compatibility
The following compatibility table specifies the recommended version or versions of the MongoDB Java Driver for use with a specific version of Java. Starting with Java 11, the table explicitly lists only Long-Term-Support (LTS) Java versions.
The first column lists the driver version.
Java Driver Version | Java 21 | Java 17 | Java 11 | Java 8 | Java 7 | Java 6 | Java 5 |
---|---|---|---|---|---|---|---|
4.11 to 5.5 | ✓ | ✓ | ✓ | ✓ | |||
4.5 to 4.10 | ✓ [2] | ✓ | ✓ | ✓ | |||
4.4 | ✓ | ✓ | ✓ | ||||
4.0 to 4.3 | ✓ | ✓ | |||||
3.8 to 3.12 | ✓ | ✓ | ✓ | ✓ |
[2] | This driver version is not compatible with virtual threads. |
For more information about how to read the compatibility tables, see our guide on MongoDB Compatibility Tables.