MongoDB Java Driver

The next generation Java driver for MongoDB

Latest documentation

Introduction

The official MongoDB Java Driver providing both synchronous and asynchronous interaction with MongoDB. Powering the drivers is a new driver core and BSON library.

Features

BSON Library
A standalone BSON library, with a new Codec infrastructure that you can use to build high-performance encoders and decoders without requiring an intermediate Map instance.
MongoDB Driver
An updated Java driver that includes the legacy API as well as a new generic MongoCollection interface that complies with a new cross-driver CRUD specification.
MongoDB Async Driver
A new asynchronous API that can leverage either Netty or Java 7's AsynchronousSocketChannel for fast and non-blocking IO.
Core driver
The MongoDB Driver and Async Driver are both built on top of a new core library, which anyone can use to build alternative or experimental high-level APIs.

Quick Start

The recommended way to get started using one of the drivers in your project is with a dependency management system. Select the driver, version and dependency management system below and the snippet can be copied and pasted into your build.

Alternatively, head over to our documentation to learn more about getting started with Java and MongoDB.


<dependencies>
    <dependency>
        <groupId>org.mongodb</groupId>
        <artifactId>mongodb-driver</artifactId>
        <version>3.4.2</version>
    </dependency>
</dependencies>

The synchronous driver, new in 3.0.
For older versions of the driver or for OSGi-based applications please use the mongo-java-driver.

Releases

ReleaseDocumentation
3.5.0-SNAPSHOT Reference | API
3.4.2 Reference | API
3.3.0 Reference | API
3.2.2 Reference | API
3.1.1 Reference | API
3.0.4 Reference | API
2.14.2 Reference | API
2.13.3 Reference | API

MongoDB University

M101J: MongoDB for Java Developers

Learn everything you need to know to get started building a MongoDB-based app. From basic installation, JSON, schema design, querying, insertion of data, indexing and working with the Java driver.

Learn More