开发者

Suggestion for Ancestry type Database: MongoDB, Redis, etc.?

I'm writing a ruby app that stores ancestry type data. I.e. Family tree.

For the rest of the application I'm using MongoDB for storage as it lends itself to a hierarchical structure, however ancestry data doesn't quite fit that model, even though it is hierarchical in a sense. I'm curious if anyone has a suggestion on whether I should be swapping in a more appropriate database layer to handle these?

I.e. A is paired with B (bidirectional) and has parents C and D. B has parents E and F. A and B have children G, H, I. G is paired with H, and so on.

So it's not quite recursive since one node has 2 parent nodes. Therefore embedding doesn't make sense in MongoDB since both parents would embed the same tree in duplicate. It's closer to a social graph only more rigid (there's only 2 types of relationships). I'm thinking Redis sets would work very well, but before I go complicating the stack with Polyglot p开发者_开发技巧ersistence, I was hoping I could get some feedback from others who may have designed similar structures. The other concern I have with Redis is storing all of these trees in memory might not be a great idea, although if I was only storing the relationships in Redis with the object data in MongoDB documents it would probably be ok.


Maybe you should try out a graph database as it sounds much closer to the domain. And there are quite a few out there you could try out http://nosql.mypopescu.com/post/498705278/quick-review-of-existing-graph-databases

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜