试图找出`mongodb-driver-sync v 4.6.0`和`mongo-java-driver v 3.12.10`
我们正在我们的Clojure项目中使用congomongo Toolkit:
https://github.com/congomongo/congomongo/congomongo/congomongo
这取决于传统的Java驱动程序(in project.clj):
[org.mongodb/mongo-java-driver“ 3.12.10”]
我现在试图滚动自己的clojure包装器,因为我们需要升级到现代API。它引用:
[org.mongodb/mongodb-driver-sync“ 4.6.0”]
,
包括我们项目中的两者都引起了冲突:
Syntax error (IllegalAccessError) compiling at (/tmp/form-init13152456523068551352.clj:1:74).
failed to access class com.mongodb.client.internal.MongoClientDelegate from class com.mongodb.Mongo (com.mongodb.client.internal.MongoClientDelegate and com.mongodb.Mongo are in unnamed module of loader 'app')
然后,我更改了包装器以使用相同的3.12.10驱动程序。现在一切都很好。刚果正在使用传统驱动程序,我的包装纸正在使用现代驾驶员,而且没有冲突。
这是预期的行为吗? Mongo-Java-Driver是否包括传统驾驶员和现代驾驶员?还是我应该意识到有区别?
We're using CongoMongo toolkit in our Clojure project:
https://github.com/congomongo/congomongo
It depends on a legacy Java driver (in project.clj):
[org.mongodb/mongo-java-driver "3.12.10"]
I'm now trying to roll my own Clojure wrapper because we need to upgrade to the modern API. It references :
[org.mongodb/mongodb-driver-sync "4.6.0"]
Including both in our project caused a conflict:
Syntax error (IllegalAccessError) compiling at (/tmp/form-init13152456523068551352.clj:1:74).
failed to access class com.mongodb.client.internal.MongoClientDelegate from class com.mongodb.Mongo (com.mongodb.client.internal.MongoClientDelegate and com.mongodb.Mongo are in unnamed module of loader 'app')
I then changed my wrapper to use the same 3.12.10 driver. Now everything works fine. CongoMongo is using the legacy driver, my wrapper is using the modern driver, and there's no conflict.
Is this expected behaviour? Does mongo-java-driver include both the legacy driver and the modern driver? Or is there a difference I should be aware about?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,3.X系列驱动程序既包含旧的API和现代API,但是4.X系列仅包含现代API。
您可以通过在JAR文件中查看:
MongoClientOptions
是Legacy API的一部分,mongoclientsettings
是现代API的一部分。Yes, the 3.x series of drivers contains both the legacy API and the modern API but the 4.x series only contains the modern API.
You can see this by looking in the JAR files:
MongoClientOptions
is part of the legacy API,MongoClientSettings
is part of the modern API.