Firestore查询操作字符串如何处理不同的数据类型? [英] How does Firestore query operation strings treat different data types?
问题描述
opStr
(操作字符串)如何="https://firebase.google.com/docs/reference/js/firebase.firestore.Query#where" rel ="nofollow noreferrer">其中查询方法处理不同的数据类型?
How does the Firestore opStr
(Operation Strings) in the where query method treat different data types?
不同的操作字符串为:<, <=, ==, >, and >=
The different operation strings are: <, <=, ==, >, and >=
对于number
数据类型,这很容易解释,但是对于其他数据类型呢? string
,boolean
,object
,array
,null
,timestamp
,geopoint
和reference
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
例如string
数据类型,>=
表示是否等于或包含字符串?
那么db.collection('users').where('lastname','>=','bar')
会返回姓氏为bar或包含bar的所有用户吗?例如bar
,foobar
,barbaz
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.
一些例子:
-
"a" < "b"
-
"aaa" < "aab"
-
"abc" < "abcd"
"a" < "b"
"aaa" < "aab"
"abc" < "abcd"
还有:
-
"000" < "001"
-
"010" < "011"
-
"100" < "101"
"000" < "001"
"010" < "011"
"100" < "101"
但例如:
-
"2" > "10"
因为"2"
的字母顺序晚于unicode中的"1"
.
Since the "2"
is alphabetically later than the "1"
in unicode.
这篇关于Firestore查询操作字符串如何处理不同的数据类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!