Start a new topic

How do I add a sort order to a query from a collection access?

I'm using Google App Engine.

The following code below works as expected, but I'm trying to find out how to sort the results. I would like to sort by a specific key.

Collection collection = new Collection("Collection");

Query query = new Query();

query.equals("key", value).lessThan("key", value).greaterThan("key", value);

try {

List docs = collection.find(query, null);

} catch (CollectionAccessException cae) {


Most of the examples i see online recommend something like collection.find(query, null).sort(); but that doesn't seem to be supported by the Kinvey implementation on Google App Engine.

I don't see "sort" being available at all. Perhaps you are looking for this?

var query = new Kinvey.Query();

query.limit(5).equalTo('last_name', 'Doe').ascending('first_name');

You just use 'ascending' as a property of the query rather than 'sort'.

Of course, I haven't every touched the Google App Engine code; so, I could be wrong here.
Unfortunately, the Kinvey Query object in Google App Engine does not have methods for setting a limit or ascending and descending sort. Perhaps someone from Kinvey can clarify this...
That is correct, the Kinvey Query object in GAE currently does not support sort.
Login or Signup to post a comment