HAS ANCESTOR and HAS DESCENDANT clauses in google cloud datastore

和自甴很熟 提交于 2019-12-07 12:56:11

问题


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!


回答1:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!