MongoDB“模式”有一个好的框架吗? Scala 中存在升级吗?
MongoDB 架构迁移/升级有哪些选项?
我们(我和我的同事)有一个相当大的(约 1 亿条记录)MongoDB 集合。该集合被映射(ORM)到一个经过多次不同迭代的 Scala lift-mongodb 对象。我们有各种各样的代码来处理丢失的字段、重命名、删除、迁移等。
尽管整个“无模式”的事情可以很好而且灵活,但在这种情况下,它会导致很多代码混乱随着我们的目标不断发展。继续走这条“灵活对象”的道路是不可持续的。
你们是如何使用 Scala 在 MongoDB 中实现模式迁移/升级的?是否存在这样的框架?我知道 Foursquare 将 Scala 与 MongoDB 和 Rogue(他们自己的查询 DSL)结合使用...有人知道他们如何处理迁移吗?
谢谢。
What are the options for MongoDB schema migrations/upgrades?
We (my colleagues and I) have a somewhat large (~100 million record) MongoDB collection. This collection is mapped (ORM'd) to a Scala lift-mongodb object that has been through a number of different iterations. We've got all sorts of code in there which handles missing fields, renames, removals, migrations, etc.
As much as the whole "schema-less" thing can be nice and flexible, in this case it's causing a lot of code clutter as our object continues to evolve. Continuing down this "flexible object" path is simply not sustainable.
How have you guys implemented schema migrations/upgrades in MongoDB with Scala? Does a framework for this exist? I know that Foursquare uses Scala with MongoDB and Rogue (their own query DSL)... does anyone know how they handle their migrations?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许这可以有所帮助,这就是 Guardian.co.uk 处理这个问题的方式:
http://qconlondon.com/dl/qcon-london-2011/slides/MatthewWall_WhyIChoseMongoDBForGuardianCoUk.pdf
架构升级
这可以通过以下方式缓解:
Perhaps this can help somewhat, this is how Guardian.co.uk handle this:
http://qconlondon.com/dl/qcon-london-2011/slides/MatthewWall_WhyIChoseMongoDBForGuardianCoUk.pdf
Schema upgrades
This can be mitigated by:
我使用自己的 Scala 框架"Subset" 对 MongoDB 数据的迁移进行编程。它可以非常轻松地定义文档字段,微调数据序列化(例如,编写“日期”是特定格式等)并根据定义的字段构建查询和更新修饰符。这个 "gist" 给出了很好的介绍
I program migrations of MongoDB data with my own Scala framework "Subset". It lets define document fields pretty easily, fine tune data serialization (e.g. write "date" is a specific format and so on) and build queries and update modifiers in terms of the defined fields. This "gist" gives a good introduction