I'm studying the Google Cloud Datastore GQL grammar - specifically the HAS ANCESTOR
and HAS DESCENDANT
comparison operators.
Giving the following Person entities:
- Amy
- Fred, parent = Amy
- Laura, parent = Amy
- Paul
- Agnes ...
Would the GQL queries below produce the same output?
SELECT * FROM Person WHERE key_name='Fred' HAS ANCESTOR KEY('Person', 'Amy')
SELECT * FROM Person WHERE KEY('Person', 'Amy') HAS DESCENDANT key_name='Fred'
If so, I don't understand the existence of HAS DESCENDANT clause.
Thanks in advance!
Alfred Fuller
These two GQL queries should produce identical results:
SELECT * FROM Person WHERE __key__ HAS ANCESTOR KEY('Person', 'Amy')
SELECT * FROM Person WHERE KEY('Person', 'Amy') HAS DESCENDANT __key__
来源:https://stackoverflow.com/questions/20553266/has-ancestor-and-has-descendant-clauses-in-google-cloud-datastore