Sorting of storage documents by two fields

0 votes

We're implementing a custom leaderboard and we need to sort the documents first by creation date and then by an integer number, and then extract the documents. This is needed in case there are two player with the same score and we'd like to show them by creation date. Will this code work?

HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
otherMetaHeaders.put("orderByAscending", "_$createdAt");
otherMetaHeaders.put("orderByDescending", "rating");
storageService.setOtherMetaHeaders(otherMetaHeaders);  
asked Dec 6, 2014 in App42 Cloud API-BaaS by vladislav (10 points)

1 Answer

0 votes
Hi,
 
Sorting doc by multiple keys is not supported yet. However it can be done by sorting second keys at client it self. You can also consider writing custom code and doing it there instead of in your app.
 
Let me know if it's helps.
 
Thanks
/sachin

 

answered Dec 7, 2014 by SACHIN25 (190 points)
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...