Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

The official MongoDB drivers for Java, Kotlin, and Scala

License

NotificationsYou must be signed in to change notification settings

mongodb/mongo-java-driver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Release notes are availablehere.

Documentation

Reference and API documentation for the Java driver is availablehere.

Reference and API documentation for the Kotlin driver is availablehere.

Reference and API documentation for the Scala driver is availablehere.

Tutorials / Training

For tutorials on how to use the MongoDB JVM Drivers, please referenceMongoDB University. Additional tutorials, videos, and code examples using both the Java Driver and the Kotlin Driver can also be found in theMongoDB Developer Center.

Support / Feedback

For issues with, questions about, or feedback for the MongoDB Java, Kotlin, and Scala drivers, please look intooursupport channels. Pleasedo not email any of the driver developers directly with issues orquestions - you're more likely to get an answer on theMongoDB Community Forums orStackOverflow.

At a minimum, please include in your description the exact version of the driver that you are using. If you are havingconnectivity 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 forany connectivity-related exceptions and post those as well.

Bugs / Feature Requests

Think you’ve found a bug in the Java, Kotlin, or Scala drivers? Want to see a new feature in the drivers? Please open acase in our issue management tool, JIRA:

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

If you’ve identified a security vulnerability in a driver or any otherMongoDB project, please report it according to theinstructions here.

Versioning

We followsemantic versioning when releasing.

@Alpha

APIs marked with the@Alpha annotation are in the early stages of development, subject to incompatible changes,or even removal, in a future release and may lack some intended features. An APIs bearing@Alpha annotation maycontain known issues affecting functionality, performance, and stability. They are also exempt from any compatibilityguarantees made by its containing library.

It is inadvisable forapplications to use Alpha APIs in production environments or forlibraries(which get included on users' CLASSPATHs, outside the library developers' control) to depend on these APIs. Alpha APIsare intended forexperimental purposes only.

@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 evenremoved, 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 notuse 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 isrecommended to stop using them.

com.mongodb.internal.*

All code inside thecom.mongodb.internal.* packages is considered private API and should not be relied upon at all. It can change at anytime.

Binaries

Binaries and dependency information for Maven, Gradle, Ivy and others can be found athttps://central.sonatype.com/search.

Example for Maven:

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

Snapshot builds are also published regulary via Sonatype.

Example for Maven:

<repositories>    <repository>        <name>Central Portal Snapshots</name>        <id>central-portal-snapshots</id>        <url>https://central.sonatype.com/repository/maven-snapshots/</url>        <releases>            <enabled>false</enabled>        </releases>        <snapshots>            <enabled>true</enabled>        </snapshots>    </repository></repositories>

Build

Java 17+ and git is required to build and compile the source. To build and test the driver:

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

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

$ mkdir -p data/db$ 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 increasethe number of available file descriptors prior to starting mongod as described inhttps://www.mongodb.com/docs/manual/reference/ulimit/

IntelliJ IDEA

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

  • Java 17+ is required to build and compile the source.

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

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

    • Run thegenerateBuildConfig task: eg:./gradlew generateBuildConfig or via Gradle > driver-core > Tasks > buildconfig >generateBuildConfig
    • SetgenerateBuildConfig to execute Before Build. via Gradle > Tasks > buildconfig > right click generateBuildConfig - click on"Execute Before Build"
    • Delegate all build actions to Gradle: Settings/Preferences > Build, Execution, Deployment > Build Tools > Gradle > Build and runusing/Run tests using - select "Gradle"

[8]ページ先頭

©2009-2025 Movatter.jp