Mixin: CollectionOrdering

CollectionOrdering

CollectionOrdering mixin.

Methods


sort( [SortExprStr])

Set the order options of the result set.
Parameters:
Name Type Argument Description
SortExprStr string | Array.<string> <optional>
properties (and direction) to sort by
Returns:
The query instance.
Type
CollectionOrdering
Example
// 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'])