This mixin grants sorting capabilities to a collection statement instance via composition.
Establishes the order of one or more specific fields in the result set. This method does not cause the statement to be executed but changes the statement boundaries, which means that if it has been prepared before, it needs to be re-prepared.
Name Type Argument Description
One or more expressions establishing the order on which the given fields are sorted.
Returns:The instance of the statement itself following a fluent API convention.
// arguments as columns (and direction) to sort const query = collection.find().sort('foo asc', 'bar desc') // array of columns (and direction) to sort const query = collection.find().sort(['foo asc', 'bar desc'])