Example: Sorting

Use the following query option to apply sorting:

sorting

Type: Comfortable.Sorting sort query results ascending or descending by certain fields

Parameters

const api = Comfortable.api('<repository-api-id>', '<api-key>');

var options = {
    sorting: new Comfortable.Sorting()
        .add('createdAt', 'asc', 'meta')
        .add('title', 'asc')
}


api.getDocuments(options)
  .then(result => {
    // futher implementation
  })
  .catch(err => {
    throw err;
  })

Last updated