The Java driver for MongoDB
Clone or download
thejonathanma Update bulkwrite spec tests
This commit updates the bulkwrite spec tests, including adding a
new spec test 'unacknowledgedBulkWrite.json'. CommandMonitoringTest
was updated to account for the new bulkwrite spec tests format.

JAVA-2849
Latest commit ccd74b3 Sep 18, 2018
Permalink
Failed to load latest commit information.
.evergreen JAVA-2649: Implement driver benchmark specification Jul 27, 2018
bson Allow BsonBinary to be created from UUIDs Sep 11, 2018
config Change streams now save the startAtOperationTime Jun 19, 2018
docs Docs: Updated version to 3.8.2 Sep 19, 2018
driver-async Update bulkwrite spec tests Sep 20, 2018
driver-benchmarks JAVA-2649: Implement driver benchmark specification Jul 27, 2018
driver-core Update bulkwrite spec tests Sep 20, 2018
driver-embedded Update bulkwrite spec tests Sep 20, 2018
driver-legacy JAVA-2958: Deprecate DB#eval and DB#doEval Sep 4, 2018
driver-sync Update bulkwrite spec tests Sep 20, 2018
gradle Added publishArchives version checking task Aug 16, 2018
mongo-java-driver Store driver version in a generated class Aug 16, 2018
mongodb-driver Normalized Copytight notices - gradle files. Jan 30, 2018
util JAVA-2560 : Use jdk.javadoc.doclet package Apr 30, 2018
.gitattributes Removed special treatment for .bat files Jun 4, 2013
.gitignore Added jenv local files to .gitignore May 25, 2018
.travis.yml JAVA-2560 : Use jdk.javadoc.doclet package Apr 30, 2018
CONTRIBUTING.md JAVA-2560 : Update contributing guide Apr 30, 2018
LICENSE.txt JAVA-2374: Move third party notices from LICENSE.txt to a THIRD-PARTY… Mar 8, 2017
README.md Store driver version in a generated class Aug 16, 2018
THIRD-PARTY-NOTICES Reverted copyright changes Jun 21, 2018
build.gradle Store driver version in a generated class Aug 16, 2018
gradle.properties Normalized Copytight notices - gradle files. Jan 30, 2018
gradlew JAVA-2786 : Upgrade Gradle to 4.5.1 (#455) Feb 19, 2018
gradlew.bat Update Gradle to 4.0.1 Aug 22, 2017
settings.gradle JAVA-2649: Implement driver benchmark specification Jul 27, 2018

README.md

Release Notes

Release notes are available here.

API Documentation:

Javadoc for all major and minor releases is available here.

Support / Feedback

For issues with, questions about, or feedback for the MongoDB Java driver, please look into our support channels. Please do not email any of the Java driver developers directly with issues or questions - you're more likely to get an answer on the mongodb-user list on Google Groups.

At a minimum, please include in your description the exact version of the driver that you are using. If you are having connectivity issues, it's often also useful to paste in the line of code where you construct the MongoClient instance, along with the values of all parameters that you pass to the constructor. You should also check your application logs for any connectivity-related exceptions and post those as well.

Bugs / Feature Requests

Think you’ve found a bug? Want to see a new feature in the Java driver? Please open a case in our issue management tool, JIRA:

Bug reports in JIRA for the driver and the Core Server (i.e. SERVER) project are public.

If you’ve identified a security vulnerability in a driver or any other MongoDB project, please report it according to the instructions here.

Versioning

Major increments (such as 2.x -> 3.x) will occur when break changes are being made to the public API. All methods and classes removed in a major release will have been deprecated in a prior release of the previous major release branch, and/or otherwise called out in the release notes.

Minor 3.x increments (such as 3.1, 3.2, etc) will occur when non-trivial new functionality is added or significant enhancements or bug fixes occur that may have behavioral changes that may affect some edge cases (such as dependence on behavior resulting from a bug). An example of an enhancement is a method or class added to support new functionality added to the MongoDB server. Minor releases will almost always be binary compatible with prior minor releases from the same major release branch, exept as noted below.

Patch 3.x.y increments (such as 3.0.0 -> 3.0.1, 3.1.1 -> 3.1.2, etc) will occur for bug fixes only and will always be binary compitible with prior patch releases of the same minor release branch.

@Beta

APIs marked with the @Beta annotation at the class or method level are subject to change. They can be modified in any way, or even removed, at any time. If your code is a library itself (i.e. it is used on the CLASSPATH of users outside your own control), you should not use beta APIs, unless you repackage them (e.g. by using shading, etc).

@Deprecated

APIs marked with the @Deprecated annotation at the class or method level will remain supported until the next major release but it is recommended to stop using them.

com.mongodb.internal.*

All code inside the com.mongodb.internal.* packages is considered private API and should not be relied upon at all. It can change at any time.

Binaries

Binaries and dependency information for Maven, Gradle, Ivy and others can be found at http://search.maven.org.

Example for Maven:

<dependency>
    <groupId>org.mongodb</groupId>
    <artifactId>mongodb-driver</artifactId>
    <version>x.y.z</version>
</dependency>

For an all-in-one jar (which embeds the core driver and bson):

<dependency>
    <groupId>org.mongodb</groupId>
    <artifactId>mongo-java-driver</artifactId>
    <version>x.y.z</version>
</dependency>

Snapshot builds are also published regulary via Sonatype.

Example for Maven:

    <repositories>
        <repository>
            <id>sonatype-snapshot</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        </repository>
    </repositories>

For binaries containing the asynchronous API, see the driver-async README.

Build

To build and test the driver:

$ git clone https://github.com/mongodb/mongo-java-driver.git
$ cd mongo-java-driver
$ ./gradlew check

The test suite requires mongod to be running with enableTestCommands, which may be set with the --setParameter enableTestCommands=1 command-line parameter:

$ mongod --dbpath ./data/db --logpath ./data/mongod.log --port 27017 --logappend --fork --setParameter enableTestCommands=1

If you encounter "Too many open files" errors when running the tests then you will need to increase the number of available file descriptors prior to starting mongod as described in https://docs.mongodb.com/manual/reference/ulimit/

IntelliJ IDEA

A couple of manual configuration steps are required to run the code in IntelliJ:

  • Java 9 is required to build and compile the source.

  • Error: java: cannot find symbol: class SNIHostName location: package javax.net.ssl
    Fix: Settings > Build, Execution, Deployment > Compiler > Java Compiler - untick "Use '--release' option for cross-compilation (Java 9 and later)"

  • Error: java: package com.mongodb.internal.build does not exist
    Fixes: Any of the following:

  • Run the compileBuildConfig task: eg: ./gradlew compileBuildConfig or via Gradle > driver-core > Tasks > other > compileBuildConfig

  • Set compileBuildConfig to execute Before Build. via Gradle > Tasks > other > right click compileBuildConfig - click on "Execute Before Build"

  • Delegate all build actions to Gradle: Settings > Build, Execution, Deployment > Build Tools > Gradle > Runner - tick "Delegate IDE build/run actions to gradle"

Build status:

Build Status

Maintainers

Contributors:

Additional contributors can be found here.

Supporters

YourKit is supporting this open source project with its YourKit Java Profiler.

JetBrains is supporting this open source project with:

Intellij IDEA