I'm facing an issue with a query that searches for a gameCreatedAt
equal to null
. Even though the collection doesn't have any null
values, it still retrieves data inexplicably!
Here is how the query is written:
const query = firestore().collection('matches')
query.where('gameStartedAt', '==', null)
query.where(`lobby.${uid}`, '>', 0)
query.orderBy('createdAt', 'desc')
query.limit(1)
And this is what the data looks like: https://i.sstatic.net/AfOfX.png
I am puzzled as to why the
query.where('gameStartedAt', '==', null)
condition appears to be silently dropped. I was hoping someone could shed light on this peculiar behavior. While the criteria works in other programming languages using something like NSNULL()
as mentioned in this stackoverflow post, in JavaScript, null
seems to just end up being ignored.