本文介绍了Google Cloud Datastore中的HAS ANCESTOR和HAS DESCENDANT子句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究 Google Cloud Datastore GQL语法-特别是HAS ANCESTORHAS DESCENDANT比较运算符.

I'm studying the Google Cloud Datastore GQL grammar - specifically the HAS ANCESTOR and HAS DESCENDANT comparison operators.

提供以下 Person 实体:

  • 艾米
  • 弗雷德,父母=艾米
  • 劳拉,父母=艾米
  • Paul
  • Agnes ...

下面的GQL查询会产生相同的输出吗?

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'

如果是这样,我不了解HAS DESCENDANT子句的存在.

If so, I don't understand the existence of HAS DESCENDANT clause.

提前谢谢!

推荐答案

这两个GQL查询应产生相同的结果:

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__

这篇关于Google Cloud Datastore中的HAS ANCESTOR和HAS DESCENDANT子句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-24 15:36