谷歌应用程序引擎反向键序查询 [英] google app engine reverse key order query
问题描述
我正在使用Google App Engine(GAE)GO版本的数据存储查询。我想以相反的顺序得到密钥列表。前向订单可以工作,但是当我将连字符添加到订单子句时,它将失败。
q = q.Order(-__ key__)
出现错误:
错误:API错误4(datastore_v3:NEED_INDEX):未找到匹配的索引。
这是一个错误吗?或不支持?
解决方案不支持。
q.Order(__ key __)
使用EntitiesByKind
索引,该索引仅为升序。
请参阅 https://developers.google。 com / appengine / articles / storage_breakdown#anc-indextables 获取详细信息。
I'm using Google App Engine (GAE) GO version of a datastore query. I want to get the list of keys in reverse order. Forward order works, but when I add the hyphen to the order clause it fails.
q = q.Order("-__key__")
with the error:
Error: API error 4 (datastore_v3: NEED_INDEX): no matching index found.
Is this a bug? or not supported?
解决方案Not supported.
q.Order("__key__")
uses theEntitiesByKind
index, which is ascending-only.See https://developers.google.com/appengine/articles/storage_breakdown#anc-indextables for details.
这篇关于谷歌应用程序引擎反向键序查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!