It was intended to work that way. The documentation states that:
When a query involves a field with values of mixed types, Cloud
Firestore uses a deterministic ordering based on the internal
representations. The following list shows the order:
- Null values
- Boolean values
- Integer and floating-point values, sorted in numerical order
- Date values
- Text string values
- [...]
Note that it only follows this order when you're running a query with values of mixed types. In your query you're passing a Date
value, which means it will only query on values of Date
type and not the others (like null
for example).
In order to get the null
values, you can create a compound query, by adding a second Where
:
Collection("products").Where("producedDate", "<", "2018-01-15").Where("producedDate", "==", null)