GQL IN 运算符错误

GQL IN operator error

我在使用 "IN" 运算符的 GQL 查询中遇到应用引擎错误。我的查询如下:

SELECT * FROM ratings WHERE rating >= 0.0 AND cat = 1 AND pid IN(44,14)

错误信息是:

PHP Fatal error:  Uncaught exception 'google\appengine\runtime\ApplicationError' with message 'Encountered "IN" at line 1, column 84.
Was expecting one of:
    "contains" ...
    "has" ...
    "is" ...
    "=" ...
    "<" ...
    "<=" ...
    ">" ...
    ">=" ...
    "." ...
    "(" ...
    ' in /base/data/home/runtimes/php/sdk/google/appengine/runtime/RealApiProxy.php:53

我将我的查询放在数据存储区管理控制台中,它没有任何错误地工作并显示了准确的结果。 怎么了??

您对 IN 运算符的作用感到困惑。它不能做你想做的事。

请阅读云数据存储上的文档https://cloud.google.com/datastore/docs/apis/gql/gql_reference

Notice that the operator = is another name for the IN and CONTAINS operators. For example, <value> = <property-name> is the same as <value> IN <property-name>, and <property-name> = <value> is the same as <property-name> CONTAINS <value>. Also <property-name> IS NULL is the same as <property-name> = NULL.