Randy Walsh
Randy Walsh

Reputation: 11

google app engine reverse key order query

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?

Upvotes: 1

Views: 503

Answers (1)

Dave W. Smith
Dave W. Smith

Reputation: 24966

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.

Upvotes: 1

Related Questions