문제

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 persistence, 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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top