Sort
pulse.sort(query)
pulse.sort(query)
The sort
method customizes the sorting order of jobs when querying the MongoDB database. This order can significantly affect the efficiency and priority with which jobs are processed.
Example Usage
Parameters
query
(object
): A MongoDB sort query object that specifies how to order the jobs. For example,{ nextRunAt: 1, priority: -1 }
will sort jobs primarily by their next scheduled run time in ascending order and by priority in descending order if there are ties.
Returns
Pulse
: Returns the instance of thePulse
class, enabling method chaining.
Last updated