How to keep null values at the end of sorting in Mongoose? [duplicate]
问题 This question already has an answer here : How can I sort into that nulls are last ordered in mongodb? (1 answer) Closed last year . I am querying a collection and sorting results based on a property. Some documents don't the that property value yet i.e. null. I want to keep the documents with null values at the end of the results after sorting and limiting (asc or desc). Is there a simple way in Mongoose to do that using a single query? If not, how can I use two queries separately since I