Navigation

MongoDB Java Reactive Streams

Java Reactive Streams is an official Java driver for MongoDB and is the recommended driver for working with reactive streams in the JVM ecosystem.

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.

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.

Java Reactive Streams Driver VersionMongoDB 4.4MongoDB 4.2MongoDB 4.0MongoDB 3.6MongoDB 3.4MongoDB 3.2MongoDB 3.0MongoDB 2.6
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.

Java Reactive Streams Driver VersionJava 6Java 7Java 8Java 11 [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.

Give Feedback