How to sort Storage Service document

0 votes
I can not sort the search of documents Storage Service. 
count is greater than 10 extracts the document, and I want to sort by count. 
I run the following code, but 41 have been extracted instead of 15 results. 
Please tell me how to solve. 
 
[JSON Document] 
{"count": 10} 
{"count": 41} 
{"count": 15} 
 
[code] 
String key = "count"; 
int value = 10; 
Query query = QueryBuilder.build (key, value, Operator.GREATER_THAN); 
int max = 1; 
int offset = 0; 
Storage storage = storageService.findDocsWithQueryPagingOrderBy (dbName, collectionName, query, max, offset, "count", OrderByType.ASCENDING);
ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();              
for(int i=0;i<jsonDocList.size();i++)  
{  
    System.out.println( jsonDocList.get(i).getJsonDoc());    
}

 

asked May 22, 2014 in App42 Cloud API-BaaS by appwarp (20 points)
edited May 22, 2014 by appwarp

1 Answer

0 votes
 
Best answer

Hi appwarp ,

We have tested, Its working fine on our side. Please tell which SDK version  you used? 

answered May 22, 2014 by samita.mahajan (60 points)
selected May 23, 2014 by appwarp
Hi, samita.mahajan
15 will be output when you run the above code on the client side,
41 is output when run by writing the above code to the server side custom code. (Output confirmed using LogService)

[App42 Package]
App42_JAVA_SDK_2.1.jar
app42CCLib-0.5.jar
Hi while using this method in custom code add this code snippet before your method as shown below :

HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
        otherMetaHeaders.put("orderByAscending", "count");
        storageService.setOtherMetaHeaders(otherMetaHeaders);
Thank you. Has been resolved.
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
...