Disclaimer: If there is a better place to ask this question, do tell! I have been working on this MongoDB plugin for Cake<https://github.com/ichikaway/cakephp-mongodb>- specifically, I am working on relations.
As you might know, NoSQL systems offer a different approach on associations. For one, there is no "join tables" (at least not by default), but the associated records are stored as an array of ID's in the original record (and vice-versa for HABTM). There is an extensive amount of other possibilities, but for starters, I would like to mimic Cake's default model operations. As I understand it, the CRUD operations on associations are generated (or rather, instructed) by the Model class, not the DataSource class. Current Model implementation doesn't allow the datasource to decide which IDs go where and to adjust the logic of storage to the specific database adapters (and strategies). In short, Cake Model doesn't do that well with NoSQL which I guess is a design decision. I am, however, wondering what would be the best approach to solve these issues: - Model doesn't recognize MongoID objects as UUIDs (best case scenario is a 24hex), Cake supports only 16 and 32 binary or string types - Model doesn't support the HABTM instructions specific to Mongo/NoSQL So, I am wondering how to go about solving these issues. Two ideas: - Create an intermediate "MongodbModel" class (ex. Article (app model) extends MongodbModel extends AppModel extends Model) and override the saveMany, saveAssociated and saveAll methods. - Create a Behavior and modify the CRUD logic where needed. Which approach would be more conventional? Is the second one at all feasible? Any other ideas are greatly appreciated. You can check out the code at https://github.com/dizyart/cakephp-mongodb/tree/2.0b the MongoAssociation test case offers some insight in what I'm trying to do (hasMany/belongsTo assoc. work fine). If additional details are required, I'd be happy to give them. Cheers! -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.