Update Sep 2020: v7.21.0 introduces support for not equals (!=
) queries!
That means you can now use the code bellow:
firestore.collection('employees').where('equipments.${equipm??entId}', '!=', null)
Previous answer:
Firestore has no "not equal" operator. But looking at the logic, what you're trying to do is query for values which are String
, and not null
. Firestore can do that if you pass a String to the where()
function.
So what you can do is query for values lower than uf8ff
. That's a very high code point in the Unicode range. Since it is after most regular characters in Unicode, this query will return everything that is of type String
:
firestore.collection('employees').where('equipments.${equipm??entId}', '<', 'uf8ff')
Or you can simply query for values higher than "" (empty String
):
firestore.collection('employees').where('equipments.${equipm??entId}', '>', '')
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…