I'm trying to model a horses pedigree in mongodb.
I've conducted some research on the internet and have uncovered several potential approaches:
I'm hoping to get input from some more with experience than me on both the tradeoffs of various approaches given my use cases below:
My use cases follow:
Analysis : I will want to conduct analysis on horses pedigrees relative to win and may try to answer such questions as:
Additional information: I plan on developing this application on the MEAN stack.
Thanks for your input.
The data you have is very clearly a binary tree structure. Each horse is a node in the tree, with two child nodes representing the horse's parents (ironic!)
Tutorial: Model Tree Structures in MongoDB . You can insert each horse (starting furthest up the ancestry chain) with a list of the ids for the horse's "children" (which are the horse's dam and sire).
I admit that I'm not familiar enough with MongoDB to give you specific code for your DB queries, but as Mongo is capable of hierarchical data storage, a tree should offer few to no problems.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.