在Java驱动程序中找不到MongoClient [英] Can't find MongoClient in Java Drivers
问题描述
在阅读mongo站点上有关使用Java Driver的所有文档时,它引用了使用MongoClient()建立连接。它讨论了他们以前如何使用Mongo()但它已被弃用。但是,当我下载Mongo数据库链接到的最新(或任何)版本的java驱动程序时(
JAR包含您所指的 MongoClient
类。 Latter是MongoDB Java驱动程序的新功能,仅在2.10.0版本之后才被包含(你所指的版本是2.9.3,截至目前最新的驱动程序版本是前面提到的2.11.3)
干杯;)
In reading all the documentation on the mongo site for using the Java Driver, it makes references to using MongoClient() to make a connection. It talks about how they formerly used Mongo() but it has been deprecated. However, when I download the latest (or any) version of the java driver that the Mongo database links to (http://central.maven.org/maven2/org/mongodb/mongo-java-driver/), and load it into my project libraries, I cannot import com.mongodb.MongoClient because it isn't there! I've tried half a dozen different versions of the driver they link to. I can actually make my program work just fine with the deprecated Mongo(), but I don't want to be building new software on deprecated features. I can't find anyone else with the same problem on here either
The above is from version 2.93. Can anyone help me find what I'm doing wrong or missing? I would think its the driver version but these are the links right from Mongo's website. I also don't think its usage error, as I can make everything else work just fine.
I suggest you grab driver version 2.11.3
The JAR contains the MongoClient
class that you're referring to. Latter is new to the MongoDB Java driver and has only been included since version 2.10.0 (The version you are referring to is 2.9.3, as of now the latest driver version is the aforementioned 2.11.3)
Cheers ;)
这篇关于在Java驱动程序中找不到MongoClient的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!