Better design pattern for MongoDB document-object-mapper
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 popu开发者_JAVA百科lar, 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?
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/
精彩评论