RavenDB Null and 0 order by issue

Viewed 79

I have a question regarding how to properly order by in RavenDB.

My dataset contains distance from a location to the airport. If the field is null, the distance is unknown.

When I do the orderby

Queryable.OrderBy(home => home.DistanceAirport);

It values 0 and null equally, and returns the result like this:

DistanceAirPort: null
DistanceAirPort: 0
DistanceAirPort: null
DistanceAirPort: 1

Instead I want to achieve a result where null becomes the last result.

DistanceAirPort: 0
DistanceAirPort: 1
DistanceAirPort: null
DistanceAirPort: null

If anyone has any insights, please let me know.

1 Answers
Related