google app engine reverse key order query

本小妞迷上赌 提交于 2019-12-08 05:39:00

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/25671090/google-app-engine-reverse-key-order-query

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