How does the Firestore opStr
(Operation Strings) in the where query method treat different data types?
The different operation strings are: <, <=, ==, >, and >=
For number
data type it is very self explanatory, but how about for the other data types? string
, boolean
, object
, array
, null
, timestamp
, geopoint
, and reference
So for e.g. string
data type, does >=
mean is equal to or contains string?
So db.collection('users').where('lastname','>=','bar')
would return all users that has a lastname of bar or contains bar? e.g. bar
, foobar
, barbaz
Does anyone know of any documentation for this specific subject?
For string types, the
>=
evaluates based on the lexicographical ordering of the values.Some examples:
"a" < "b"
"aaa" < "aab"
"abc" < "abcd"
And also:
"000" < "001"
"010" < "011"
"100" < "101"
But for example:
"2" > "10"
Since the
"2"
is alphabetically later than the"1"
in unicode.