When I do a get()
with an ancestor constraint, it seems like I get all entities for that ancestor key and all ancestors that it is parent to.
In this case, I am using ancestral relationships to represent a homogenous tree (all nodes represented by the same kind; every level is immediately consistent). All of the IDs I am using are globally unique and I have the parent-ID written on each entity (in addition to it being in the ancestor path).
Since the by-ancestor retrieval returns too much data (all levels at and below rather than just the immediate level; The documentation doesn't mention this and a couple of others eccentricities), I'll need to add a filter to make sure I just get back the current level.
So, the question is whether there's a difference in efficiency to do a ancestor().filter()
versus just filter()
since these both produce the same results for me.
Thanks.
Just filter()
is eventually consistent, whereas ancestor().filter()
is strongly consistent.
As you mentioned, you'll need to filter by an indexed a property to just get a particular level of the tree back.