简体   繁体   中英

How to write orderBy query in parse.com

I am building an Android messaging app using parse.com as backend. I want to find out top 10 users who have sent most number of messages.

parse.com doesn't support orderBy clause.

Database schema:

User(objectId[PK], username)
Message(objectId[PK], sender[ForeignKey], Receiver[ForeignKey]

could somebody please help me how to tackle this?

You can order with ParseQuery addAscendingOrder(keyToSortBy);

So, if you have a field with number of sent messages (numberofmessages), the query would look like:

query.addAscendingOrder("numberofmessages");

http://www.parse.com/docs/android/api/com/parse/ParseQuery.html#addAscendingOrder(java.lang.String)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM