Installation

There are two Maven artifacts available in the 3.1 release. The preferred artifact for new applications is mongodb-driver however, we still publish the legacy mongo-java-driver uber-jar. The recommended way to get started using one of the drivers in your project is with a dependency management system.

MongoDB Driver

The MongoDB Driver is the updated synchronous Java driver that includes the legacy API as well as a new generic MongoCollection interface that complies with a new cross-driver CRUD specification.

important

For OSGi-based applications: due to the fact that there are classes from the com.mongodb package in both this artifact and in the mongodb-driver-core artifact, on which this depends, this artifact is not an OSGi bundle. Please use the mongo-java-driver uber jar (described below) instead.


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

You can also download the jars directly from sonatype.

Note: mongodb-driver requires the following dependencies: bson and mongodb-driver-core

Uber MongoDB Java Driver

An uber jar that contains everything you need; the BSON library, the core library and the mongodb-driver.

Note

For OSGi-based applications: this artifact is a valid OSGi bundle.


<dependencies>
    <dependency>
        <groupId>org.mongodb</groupId>
        <artifactId>mongo-java-driver</artifactId>
        <version>3.1.1</version>
    </dependency>
</dependencies>

You can also download the jars directly from sonatype.