谷歌应用程序引擎反向键序查询 [英] google app engine reverse key order query

查看:167
本文介绍了谷歌应用程序引擎反向键序查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用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 the EntitiesByKind index, which is ascending-only.

See https://developers.google.com/appengine/articles/storage_breakdown#anc-indextables for details.

这篇关于谷歌应用程序引擎反向键序查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆