mongo-java-driver

The official MongoDB drivers for Java, Kotlin, and Scala

What is mongo-java-driver?

The official MongoDB drivers for Java, Kotlin, and Scala

Overview of mongo-java-driver

What it is

mongo-java-driver is the official MongoDB driver for Java, Kotlin, and Scala. It provides synchronous, reactive, and coroutine-based APIs to interact with MongoDB databases. The project is hosted on GitHub under the Apache-2.0 license and is maintained by MongoDB, Inc. It supports connecting to MongoDB instances, performing CRUD operations, and managing database transactions. The driver follows semantic versioning and includes annotations such as @Alpha, @Beta, and @Deprecated to indicate API stability. Internal packages under com.mongodb.internal.* are considered private and subject to change without notice. Binaries are available on Maven Central, and snapshot builds are published via Sonatype. The source code requires Java 17+ and Git to build, using Gradle as the build system. The test suite requires a running mongod instance with enableTestCommands enabled.

Key features

  • Synchronous, reactive streams, and Kotlin coroutine drivers for Java, Kotlin, and Scala.
  • Full CRUD operations, aggregation, change streams, and transactions support.
  • Connection pooling, automatic failover, and load balancing for replica sets and sharded clusters.
  • Support for MongoDB Atlas, on-premises deployments, and local development.
  • Annotations (@Alpha, @Beta, @Deprecated) to communicate API maturity and stability.
  • Private internal API packages (com.mongodb.internal.*) that are not intended for public use.
  • Build and test infrastructure using Gradle, with a test suite that requires a running mongod.

Use cases

Building applications in Java, Kotlin, or Scala that need to store, query, and manage data in MongoDB. Suitable for web applications, microservices, data pipelines, and real-time analytics. Can be used with MongoDB Atlas for cloud-hosted databases or with self-managed MongoDB deployments. The driver is appropriate for both synchronous and asynchronous programming models, including reactive streams and coroutines.

Getting started

To build and test the driver from source, clone the repository and run Gradle check:$ git clone --recurse-submodules https://github.com/mongodb/mongo-java-driver.git$ cd mongo-java-driver$ ./gradlew checkFor Maven dependency, add the following to your pom.xml:xml org.mongodb mongodb-driver-sync x.y.zSee the repository README for full documentation and API references.

License and pricing

The project is licensed under Apache-2.0 and is open source. Pricing is not stated; the driver is free to use.

Based on the project's public README and repository metadata.

Add this badge to your README

Featured on YunoDB Badge styles & help

Maintain this project? Show that it is featured on YunoDB.

Markdown[![Featured on YunoDB](https://yunodb.com/badge/mongodbmongo-java-driver.svg)](https://yunodb.com/tools/mongodbmongo-java-driver?utm_source=github&utm_medium=badge)
HTML<a href="https://yunodb.com/tools/mongodbmongo-java-driver?utm_source=github&utm_medium=badge"><img src="https://yunodb.com/badge/mongodbmongo-java-driver.svg" alt="Featured on YunoDB" height="20"></a>