Suppose I have a schema with two fields:
someDate: Date
isPriority: boolean
I want to create a sort query based on someDate
, where records with isPriority: true
are always prioritized first. How can this be achieved? Currently, I am able to sort by date as follows:
Record.find().sort({ someDate: -1 });