Say you have the hierarchical storage concept of "Foo." "Foo" holds an id, various values, and zero to many "Foo." Obviously, in turn, the child elements can hold zero to many Foos. The data is purely hierarchical: a given Foo will belong to zero to one Foos, and thus there is never a concern of multiple parents.
The data is stored in some sort of data format (JSON, BSON, XML, etc), within a storage technology (such as MongoDB, flat file, etc). We'll assume that both of these are unknown, so a system agnostic architecture is desired.
What architecture principles/choices would dictate if the objects should be stored hierarchical (directly into the storage medium with children existing as actual children) or flatly, with all parents and children at the same level (and references to children via ids).
My inclination is that storing the objects in the natural hierarchical pattern is the ideal, however I'm uncertain if this is possibly a performance concern (if a specific child is needed to be found, which would require some sort of searching through the tree structure?).
I've seen Web APIs exposed both ways, and code repositories dealing with both forms. I can't, however, find the decision points/architecture concerns formally dealt with.