I am trying to sort a few entities I pulled from a dataset according to score, but currently it returns only 1 entity instead of the 4 currently in the datastore.
The model is defined below:
class Place(ndb.Model):
"""Model for places."""
title = ndb.StringProperty()
url = ndb.StringProperty()
longitude = ndb.StringProperty()
latitude = ndb.StringProperty()
score = ndb.IntegerProperty()
votes = ndb.KeyProperty(repeated = True, kind = 'Vote')
reviews = ndb.KeyProperty(repeated = True, kind = 'Review')
And the query I'm trying to fetch the 10 highest scored places is:
places = Place.query().order(Place.score).fetch(10)
The current dataset that I have:
This results in only place A
being returned and not the other entities.
How can I sort the entities from highest to lowest score
?
PS: I have Googled all over and could not find any working solution.