mongodb/mongo-java-driver
Fork: 1478 Star: 2620 (更新于 2024-12-17 22:00:02)
license: Apache-2.0
Language: Java .
The official MongoDB drivers for Java, Kotlin, and Scala
最后发布版本: r5.1.2 ( 2024-07-10 23:57:53)
Release Notes
Release notes are available here.
Documentation
Reference and API documentation for the Java driver is available here.
Reference and API documentation for the Kotlin driver is available here.
Reference and API documentation for the Scala driver is available here.
Tutorials / Training
For tutorials on how to use the MongoDB JVM Drivers, please reference MongoDB University. Additional tutorials, videos, and code examples using both the Java Driver and the Kotlin Driver can also be found in the MongoDB Developer Center.
Support / Feedback
For issues with, questions about, or feedback for the MongoDB Java, Kotlin, and Scala drivers, please look into our support channels. Please do not email any of the driver developers directly with issues or questions - you're more likely to get an answer on the MongoDB Community Forums or StackOverflow.
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 in the Java, Kotlin, or Scala drivers? Want to see a new feature in the drivers? Please open a case in our issue management tool, JIRA:
- Create an account and login.
- Navigate to the JAVA project.
- Click Create Issue - Please provide as much information as possible about the issue type, which driver you are using, and how to reproduce your issue.
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 4.x -> 5.x) will occur when breaking 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 5.x increments (such as 5.1, 5.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, except as noted below.
Patch 5.x.y increments (such as 5.0.0 -> 5.0.1, 5.1.1 -> 5.1.2, etc) will occur for bug fixes only and will always be binary compatible with prior patch releases of the same minor release branch.
@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 may
contain known issues affecting functionality, performance, and stability. They are also exempt from any compatibility
guarantees made by its containing library.
It is inadvisable for applications to use Alpha APIs in production environments or for libraries (which get included on users' CLASSPATHs, outside the library developers' control) to depend on these APIs. Alpha APIs are intended for experimental 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 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-sync</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>
Build
Java 17+ and git is required to build and compile the source. 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:
$ 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 increase
the number of available file descriptors prior to starting mongod as described in https://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 for cross-compilation (Java 9 and later)" -
Error:
java: package com.mongodb.internal.build does not exist
Fixes: Any of the following:- Run the
generateBuildConfig
task: eg:./gradlew generateBuildConfig
or via Gradle > driver-core > Tasks > buildconfig > generateBuildConfig - Set
generateBuildConfig
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 run using/Run tests using - select "Gradle"
- Run the
最近版本更新:(数据更新于 2024-08-28 01:31:38)
2024-07-10 23:57:53 r5.1.2
2024-06-14 23:20:04 r5.1.1
2024-05-02 23:34:21 r5.1.0
2024-04-04 04:13:57 r5.0.1
2024-04-04 04:04:12 r4.11.2
2024-03-02 00:57:06 r5.0.0
2024-02-21 06:51:24 r4.11.1
2023-11-07 23:24:42 r4.11.0
2023-07-11 19:05:32 r4.10.2
2023-07-11 19:05:02 r4.10.1
主题(topics):
database, java, java-library, jvm, kotlin, kotlin-coroutines, kotlin-library, mongodb, scala
mongodb/mongo-java-driver同语言 Java最近更新仓库
2024-12-20 19:54:15 mybatis-flex/mybatis-flex
2024-12-19 21:53:46 spring-projects/spring-boot
2024-12-19 21:25:16 Stirling-Tools/Stirling-PDF
2024-12-19 16:28:14 Tornaco/Thanox
2024-12-19 10:42:01 alibaba/nacos
2024-12-18 20:58:34 dromara/forest