ParseQuery orderByDescending local data store with createdAt not working

I am trying to get the last 5 records in my local table with the following query:

List<ParseObject> results = new ArrayList();
ParseQuery<ParseObject> query = ParseQuery.getQuery("Chat"+params[0]);
query.fromLocalDatastore();
query.setLimit(5);
query.orderByDescending("createdAt");
try {
    results = query.find();
} catch (ParseException e) {
    e.printStackTrace();
}

The following query still gives me 5 elements created first, even if I add the OrderByDescending constraint. I only need the last 5 elements that I created locally.

+4
source share

All Articles