Release notes are available here.此处提供发行说明。
Reference and API documentation is available here.此处提供了参考和API文档。
For issues with, questions about, or feedback for the MongoDB Java driver, please look into our support channels. 有关MongoDB Java驱动程序的问题、疑问或反馈,请查看我们的支持渠道。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 Community Forums.请不要直接向任何Java驱动程序开发人员发送电子邮件,询问他们的问题-您更有可能在MongoDB社区论坛上得到答案。
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. 如果存在连接问题,通常也可以将传递给构造函数的所有参数的值粘贴到构建MongoClient实例的代码行中。You should also check your application logs for any connectivity-related exceptions and post those as well.您还应该检查应用程序日志中是否存在任何与连接相关的异常,并发布这些异常。
Think you’ve found a bug? Want to see a new feature in the Java driver? 你觉得你发现了一只虫子吗?想在Java驱动程序中看到新功能吗?Please open a case in our issue management tool, JIRA:请在我们的问题管理工具JIRA中打开一个案例:
Bug reports in JIRA for the driver and the Core Server (i.e. SERVER) project are public.JIRA中驱动程序和核心服务器(即服务器)项目的错误报告是公开的。
If you’ve identified a security vulnerability in a driver or any other MongoDB project, please report it according to the instructions here.如果您在驱动程序或任何其他MongoDB项目中发现了安全漏洞,请按照此处的说明进行报告。
Major increments (such as 2.x -> 3.x) will occur when break changes are being made to the public API. 对公共API进行中断更改时,将出现主要增量(例如2.x->3.x)。 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). 当添加了非平凡的新功能,或者出现了可能会影响某些边缘情况的行为变化的重大增强或错误修复时,会出现较小的3.x增量(如3.1、3.2等)(例如依赖于错误导致的行为)。An example of an enhancement is a method or class added to support new functionality added to the MongoDB server. 增强的一个示例是添加了一个方法或类,以支持添加到MongoDB服务器的新功能。 Minor releases will almost always be binary compatible with prior minor releases from the same major release branch, except 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 compatible with prior patch releases of the same minor release branch.补丁3.x.y增量(如3.0.0->3.0.1、3.1.1->3.1.2等)将仅用于bug修复,并且始终与同一次要版本分支的先前补丁版本二进制兼容。
APIs marked with the 在类或方法级别标记有@Beta注释的API可能会发生更改。@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).如果您的代码本身是一个库(即,它在您自己控制之外的用户的类路径上使用),则不应使用beta API,除非您重新打包它们(例如,使用着色等)。
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.@Deprecated
注释的API将一直受支持,直到下一个主要版本,但建议停止使用它们。
All code inside the com.mongodb.internal.*
packages is considered private API and should not be relied upon at all. com.mongodb.internal.*
包中的所有代码都被视为私有API,不应依赖。It can change at any time.它可以随时改变。
Binaries and dependency information for Maven, Gradle, Ivy and others can be found at http://search.maven.org.Maven、Gradle、Ivy和其他的二进制文件和依赖信息可以在http://search.maven.org上找到。
Example for Maven: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.快照生成也通过Sonatype定期发布。
Example for Maven:Maven的示例:
<repositories>
<repository>
<id>sonatype-snapshot</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
</repositories>
Java 9+ is required to build and compile the source. To build and test the driver:构建和编译源代码需要Java9+。要构建和测试驱动程序,请执行以下操作:
$ 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 测试套件要求mongod使用enableTestCommands运行,可以使用--setParameter enableTestCommands=1
command-line parameter:--setParameter enableTestCommands=1
命令行参数设置:
$ 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/"Too many open files"
(打开的文件太多)错误,则需要在启动mongod之前增加可用文件描述符的数量,如https://docs.mongodb.com/manual/reference/ulimit/中所述
A couple of manual configuration steps are required to run the code in IntelliJ:在IntelliJ中运行代码需要两个手动配置步骤:
Java 9+ is required to build and compile the source.构建和编译源代码需要Java9+。
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)"设置>构建、执行、部署>编译器>Java编译器-取消勾选"Use '--release' option for cross-compilation (Java 9 and later)"(为交叉编译使用'--release'选项(Java 9及更晚版本))
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 > compileBuildConfigcompileBuildConfig
任务:例如:./gradlew compileBuildConfig
或通过Gradle>驱动核心>任务>其他>compileBuildConfig
Set 将compileBuildConfig
to execute Before Build. via Gradle > Tasks > other > right click compileBuildConfig - click on "Execute Before Build"compileBuildConfig
设置为在生成之前执行。via Gradle>任务>其他>右键单击compileBuildConfig-单击“在生成之前执行”
Delegate all build actions to Gradle: Settings > Build, Execution, Deployment > Build Tools > Gradle > Runner - tick "Delegate IDE build/run actions to gradle"将所有生成操作委派给渐变:设置>构建、执行、部署>构建工具>格拉德尔>Runner-勾选“将IDE生成/运行操作委托给gradle”
Additional contributors can be found here.其他贡献者可以在这里找到。
JetBrains is supporting this open source project with:JetBrains通过以下方式支持此开源项目: