MongoDB 文档对象映射器的更好设计模式
我是 YiiMongoDbSuite 的作者,该扩展为 ActiveRecord 模式提供 MongoDB 支持,与核心 Yii 中已有的 SQL 非常相似。
我的代码变得非常流行,因为它的编写意图与 SQL 数据库的原始 Yii 方法几乎相同,以缩短学习曲线,唯一的两个主要区别是缺乏关系支持(因为 mongo 中没有这样的东西) )和不同的标准对象。
我发现我的代码非常有趣且易于使用,特别是对于已经使用 Yii 的 mongo 新人来说,但我也发现/认为在开发新功能和使用我的代码几个月后,ActiveRecord 设计模式不是一个好的选择对于面向文档的数据库,我还认为 AR 模式本身是 mongo 真正力量的限制器(即,即使在 SQL 数据库中,新 Doctrine 也放弃了 AR 模式)。
所以我的问题是,可以使用哪些替代设计模式来“释放”MongoDB/面向文档的数据库的全部“力量”?
I'm author of YiiMongoDbSuite the extension that brings MongoDB support in ActiveRecord pattern very similar to SQL one already available in core Yii.
My code became quite popular, as it was written with intention to be almost identical as the original Yii approach to the SQL db's for shorten the learning curve, the only two main differences is lack of relation support (as there is not such thing in mongo) and different criteria object.
I found that my code is very fun and easy to use, especially for mongo newcomers that was already used Yii, but I also found/think after few months of developing new features and using my code, that ActiveRecord design pattern is not a good choice for Document oriented DBs and I also think that AR pattern itself is a limiter for mongo true power (ie. new Doctrine has abandoned the AR pattern even in SQL db's).
So my question is what alternative design patterns can be used to "unleash" the full "power" of MongoDB/Document oriented DB's?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许 DataMapper 模式正是您所需要的。
这种模式可以通过不同的方式和不同的能力来实现。
更多解释可以在本书中找到: http://www.amazon.com/php -建筑师-指南-设计-模式/dp/0973589825/
Maybe DataMapper pattern is what you need.
This pattern can be realized in different ways with different abilities.
More explanation can be found in this book: http://www.amazon.com/php-architects-Guide-Design-Patterns/dp/0973589825/