Relationships with Lithium models
Can't find any documentation on relationships with Lithum models (using MongoDB). Could anyone point me to some info or show me an exa开发者_开发百科mple?
The lithium relationship work has been released with 0.10. There's the beginnings of documentation in the manual, though that's not live on the lithium site yet.
Thought you might like a quick update.
Relationships are being worked into Lithium right now, I'm not sure exactly how complete they are but I believe they are operational in some form. Check out the x-relationships branch for details.
UPDATE: For anyone Google-ing and finding this answer they are now in the core and hosted on github.
For basic relationships I would use the Ids, but realistically if you need to do a lot of relationships between collections you either need to rethink how your data is set up, or just switch to a relational database.
Non-relational databases are a poor choice when you need to have relationships.
You can use Doctrine 2 or another ORM for using relationships in Lithium with a relational database, but since Lithium is very much Mongo/Couch DB slanted in its approach, the question you have is less about Lithium and more about the NoSql approach that it is encouraging.
BTW I think relationships are not yet officially supported in Lithium, but NoSql have their own methods for mostly not needing them - or not needing them as much by nesting data in JSON like syntax. But I think this is one feature that looks like it will be coming in 1.0, expect a blog post on it fairly soon.
精彩评论