Page 1 of 1

Create a list of most popular items

Posted: Thu May 15, 2014 8:29 pm
by Bill Clanton

In my photo sharing app, we've added a "liking" ability much like other sites. So have the likes stored in a collection with the id of the photo and user id of the person that liked it.

What i need to do now is come up with a way to making a photo feed of the photos that get the most likes. Each like is saved as a separate row or record in the collection.

so how can i count the like's collection and find the photo id numbers that have the highest count. Or how can i just create a photo feed that is sorted by the number of likes that they've received.

Any direction is appreciated.


Create a list of most popular items

Posted: Fri May 16, 2014 12:16 am
by Yurii Orishchuk

Hi Bill.

Unfortunatly there is no direct method to get this kind of information from db.

But you can get items count with certain "where" criteria.

Read more about this way: http://docs.appery.io/documentation/b...

Also you can create server code that's get all items from db and counting them and return sorted data.

See details how to work with server code: http://docs.appery.io/documentation/b...

Regards.