MongoDB Java Reactive Streams¶
Introduction¶
Java Reactive Streams is an official Java driver for MongoDB and is the recommended driver for working with reactive streams in the JVM ecosystem.
Installation¶
The recommended way to get started using the driver in your project is with a dependency management system. See the Installation Guide for more information.
Connect to MongoDB Atlas¶
To connect to a MongoDB Atlas cluster, use the Atlas connection string for your cluster:
import com.mongodb.ConnectionString; import com.mongodb.client.MongoClients; import com.mongodb.client.MongoClient; import com.mongodb.client.MongoDatabase; import com.mongodb.MongoClientSettings; // ... ConnectionString connString = new ConnectionString( "mongodb+srv://<username>:<password>@<cluster-address>/test?w=majority" ); MongoClientSettings settings = MongoClientSettings.builder() .applyConnectionString(connString) .retryWrites(true) .build(); MongoClient mongoClient = MongoClients.create(settings); MongoDatabase database = mongoClient.getDatabase("test");
See Connect to MongoDB for more ways to connect.
Compatibility¶
MongoDB Compatibility¶
Java Reactive Streams Driver Version | MongoDB 4.4 | MongoDB 4.2 | MongoDB 4.0 | MongoDB 3.6 | MongoDB 3.4 | MongoDB 3.2 | MongoDB 3.0 | MongoDB 2.6 |
---|---|---|---|---|---|---|---|---|
4.2 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
4.1 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
1.13 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
1.12 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |
1.11 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||
1.10 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||
1.9 | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ||
1.7 | ✓ | ✓ | ✓ | ✓ | ✓ | |||
1.6 | ✓ | ✓ | ✓ | ✓ | ||||
1.5 | ✓ | ✓ | ✓ | ✓ | ||||
1.3 | ✓ | ✓ | ✓ | ✓ | ||||
1.2 | ✓ | ✓ | ✓ | |||||
1.1 | ✓ | ✓ | ||||||
1.0 | ✓ | ✓ |
The driver does not support older versions of MongoDB.
Language Compatibility¶
Java Reactive Streams Driver Version | Java 11 [1] | Java 8 | Java 7 | Java 6 |
---|---|---|---|---|
4.2 | ✓ | ✓ | ✓ | ✓ |
4.1 | ✓ | ✓ | ✓ | ✓ |
1.13 | ✓ | ✓ | ✓ | ✓ |
1.12 | ✓ | ✓ | ✓ | ✓ |
1.11 | ✓ | ✓ | ✓ | ✓ |
1.10 | ✓ | ✓ | ✓ | ✓ |
1.9 | ✓ | ✓ | ✓ | ✓ |
1.7 | ✓ | ✓ | ✓ | ✓ |
1.6 | ✓ | ✓ | ✓ | ✓ |
1.5 | ✓ | ✓ | ✓ | ✓ |
1.3 | ✓ | ✓ | ✓ | ✓ |
1.2 | ✓ | ✓ | ✓ | ✓ |
1.1 | ✓ | ✓ | ✓ | ✓ |
1.0 | ✓ | ✓ | ✓ | ✓ |
[1] | Java versions 8 and above are all supported thanks to the JVM backwards compatibility promise. Only LTS versions will be explicitly listed in future. |
For more information on how to read the compatibility tables, see our guide on MongoDB Compatibility Tables.
How to get help¶
- Ask questions on our MongoDB Community Forums.
- Visit our Support Channels.
- See Issues & Help.
Give Feedback