Order By Array Size

0 votes


I have a collection of jsons which have array and some other values. I want to order them by array.size and fetch them by paging. I use findDocsWithQueryPagingOrderBy method but cant succeed.

The collection is like;

In this collection, I want to receive GROUP3 first, because it has more users than others. And then GROUP1,GROUP4 and GROUP2.

Can you assist me, please? Thanks

asked Apr 12, 2015 in App42 Cloud API-BaaS by Tufan (64 points)

1 Answer

0 votes
This can not be done implicitly and you have to modify your JSON to achieve it. Save size value in number format in your JSON and use it in order by clause, this will solve your problem.

Let me know if it helps.


answered Apr 13, 2015 by ajay123 (899 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