database - Google App Engine - ndb sorting by string? (Python) -
is possible sort query results stringproperty?
i have following:
class user(ndb.model): first_name = ndb.stringproperty(indexed=false) last_name = ndb.stringproperty(indexed=false)
now if want retrieve stored entries database, use (it works):
user_query = user.query(ancestor=user_key(user_name))
but want result ordered first_name, use this:
user_query = user.query(ancestor=user_key(user_name)).order(-user.first_name)
this not work! don't know wrong , not produce errors, no results show anymore. empty table :-(
you need index order work.
Comments
Post a Comment