Mixin: CollectionOrdering

CollectionOrdering

CollectionOrdering mixin.
Source:

Methods

sort(SortExprStropt) → {CollectionOrdering}

Set the order options of the result set.
Parameters:
Name Type Attributes Description
SortExprStr string | Array.<string> <optional>
properties (and direction) to sort by
Source:
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'])