scala中有没有类似orm的mongodb库?
看来我们只能在 scala 中使用 casbah
,但我希望 scala 有一个类似 orm 的库,比如 java 的 morphia
或其他东西。
有吗?我不想在 scala 中使用 morphia
因为我必须将 java 集合转换为 scala
UPDATE
我已经尝试了其中的一些,但仍然没有找到合适的。有些对于 Scala 新手来说很难上手。
最终
最后,我选择了mongo-scala-driver,非常棒。谢谢大家。
It seems only the casbah
we can use in scala, but I hope there is a orm-like library for scala, like morphia
for java, or something else.
Is there any? I don't want to use morphia
in scala because I have to convert java collections to scala
UPDATE
I've tried some of them, but still not find a proper one. Some are hard for scala newbies to get started.
FINALLY
Finally, I chose mongo-scala-driver, its awesome. Thanks to everybody.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
有两个可靠的选择:
Salat,旨在使用案例类和 scalasig 与 Casbah 集成 - https://github .com/novus/salat/
Lift (liftweb.net) 也有一个针对 Mongo 的 activerecord ttype 库,Foursquare 已为其构建了 DSL Rogue。 http:// Engineering.foursquare.com/2011/01/21/rogue-a-type-safe-scala-dsl-for-querying-mongodb/
There are two solid options:
Salat, which is designed to integrate with Casbah using case classes and scalasig - https://github.com/novus/salat/
Lift (liftweb.net) also has an activerecord ttype library for Mongo which Foursquare has built a DSL, Rogue, for. http://engineering.foursquare.com/2011/01/21/rogue-a-type-safe-scala-dsl-for-querying-mongodb/
Spring Data 在 MongoDB 支持的 M2 中发布了类似 Morphia 的映射功能。我们已经讨论过为此提供一些原生 Scala 支持,但没有人直接提出要求,因此很难衡量兴趣。它应该可以在 Scala 中按原样使用——尽管我希望看到我们做出更多 Scala 风格的东西。
https://github.com/springsource/spring-data-document
Spring Data is releasing Morphia-like mapping capabilities in the M2 of the MongoDB support. We've talked about doing some native Scala support for this but we haven't had anyone ask for it directly, so its hard to gauge interest. It should be usable as-is from Scala--though there are things I'd like to see us make more Scala-ish.
https://github.com/springsource/spring-data-document
如果这是唯一的原因,我建议您使用 scala.collection.JavaConversions ,它包含从 Java 到 scala 的隐式转换Scalca 集合,反之亦然。
If this is the only reason, I suggest you to use
scala.collection.JavaConversions
It contains implicit conversions from Java to Scalca collections and vice verse.