So assume we have documents have a field children, which can contain the ids of other documents. For example:
{_id: 1 :children [2, 3, 4]}
{_id: 2 :children [5, 6]}
{_id: 3}
{_id: 4}
{_id: 5 :children [6, 7, 8]}
{_id: 6}
{_id: 7}
{_id: 8}
Is there a graph query that will gather all the ancestors of 8? (i.e., [1, 2, 5]) All the descendants of 2 (i.e, [5, 6, 7, 8])? The ancestors of 5 (i.e., [1,2])? The descendants of 5 (i.e., [6, 7, 8]).
This, of course, in one query call.
Can the ancestors query be done efficiently (with, perhaps, a total depth of 10)?
Can the descendants query be done efficiently (with, perhaps, thousands or tens of thousands of descendants)?