Start a new topic

Sort a collection in console.kinvey

Hello, I am making a single page app where I have posts. Because of the pagination I get only 3 posts and skip posts depending on the page.Because of that i cannot sort them. Is there a way to sort the collection from the site?

1 Comment

Yovcho,

Here is some reference that can get you started. You can use the code in Business Logic as follows:

 

var options = {
    "skip": skip,
    "limit": limit,
    "sort": {"sort_index": -1}
  };
 
    var testColl = collectionAccess.collection('test');
    testColl.find(query, options,function (err, results){
           
    }

 


Thanks,
Pranav
Kinvey

 

Login or Signup to post a comment