In addition to specifying fields to sort on and the corresponding sort order, you can now specify how documents with missing or null values should be sorted in results using the noData option.
This allows you to sort ascending on a field foo while placing documents where foo: null or foo does not exist at the end of the results.
- Read the docs
- View Playground snapshot
- Check out the examples