简体   繁体   English

MongoDB Scala异步驱动程序

[英]MongoDB Scala Async Driver

I'm evaluating the MongoDB async driver: 我正在评估MongoDB异步驱动程序:

https://github.com/mongodb/mongo-scala-driver https://github.com/mongodb/mongo-scala-driver

The API looks pretty simply, but how could I do the following transformation? 该API看起来很简单,但是如何进行以下转换?

val collection: MongoCollection[Document] = database.getCollection("test")

I would like to do an implicit transformation when I do CRUD operations on the database. 在数据库上执行CRUD操作时,我想进行隐式转换。 I could not find enough information in the reference documentation on how to do an implicit transformation. 在参考文档中找不到有关如何执行隐式转换的足够信息。

Could anyone point me to any reference on how to do an implicit transformation? 谁能指出我关于如何进行隐式转换的任何参考资料?

Scala驱动程序只是围绕Java驱动程序的一个薄包装,而不是一个纯粹的实现:( ...因此,您必须遵循Java驱动程序的约定并提供编解码器。我没有可用的示例,但是您应该能够请遵循以下步骤: http : //mongodb.github.io/mongo-java-driver/3.3/bson/codecs/并为scala类注册编解码器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM