.. include:: /includes/unicode-checkmark.rst

=============================
MongoDB Java Reactive Streams
=============================

.. default-domain:: mongodb

.. contents:: On this page
   :local:
   :backlinks: none
   :depth: 1
   :class: twocols

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.

- `Tutorials
  <http://mongodb.github.io/mongo-java-driver/4.0/driver-reactive/tutorials/>`_

- `Usage Guide
  <http://mongodb.github.io/mongo-java-driver/4.0/driver-reactive/>`_

- `API Reference
  <https://mongodb.github.io/mongo-java-driver-reactivestreams/1.13/javadoc/>`_

- `Changelog
  <https://mongodb.github.io/mongo-java-driver-reactivestreams/1.13/changelog/>`_

- `Source Code
  <https://github.com/mongodb/mongo-java-driver-reactivestreams/>`_

Installation
------------

The recommended way to get started using the driver in your project is with
a dependency management system.
See the `Installation Guide
<http://mongodb.github.io/mongo-java-driver-reactivestreams/1.13/getting-started/installation-guide/>`_
for more information.

Connect to MongoDB Atlas
------------------------

.. include:: /includes/atlas-connect-blurb.rst

.. code-block:: java

   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
<http://mongodb.github.io/mongo-java-driver/4.0/driver-reactive/tutorials/>`_
for more ways to connect.

Compatibility
-------------

MongoDB Compatibility
~~~~~~~~~~~~~~~~~~~~~

.. include:: /includes/mongodb-compatibility-table-java-rs.rst

.. include:: /includes/older-server-versions-unsupported.rst

Language Compatibility
~~~~~~~~~~~~~~~~~~~~~~

.. include:: /includes/language-compatibility-table-java-rs.rst

.. include:: /includes/help-links-java.rst
