My Firestore collection has documents with a string field, which can be null.
I was expecting that if I query:
Collection("products").Where("producedDate", "<", "2018-01-15")
I would get all products whose "producedDate" is earlier than "2018-10-15", including those whose "producedDate" is null.
But actually I am not getting the null
s.
Is this intended or it's a bug?
It was intended to work that way. The documentation states that:
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 ofDate
type and not the others (likenull
for example).In order to get the
null
values, you can create a compound query, by adding a secondWhere
: