Firestore 查询操作字符串如何处理不同的数据类型?

How does Firestore query operation strings treat different data types?

Firestore opStr (Operation Strings) in the where查询方法如何处理不同的数据类型?

不同的操作字符串是:<, <=, ==, >, and >=

对于number数据类型,它是非常不言自明的,但是对于其他数据类型呢? stringbooleanobjectarraynulltimestampgeopointreference

例如string数据类型,>=是否表示等于或包含字符串

那么 db.collection('users').where('lastname','>=','bar') 会 return 所有姓氏为 bar 或包含 bar 的用户吗?例如barfoobarbarbaz

有谁知道这个特定主题的文档吗?

对于字符串类型,>= 根据值的 lexicographical ordering 进行计算。

一些例子:

  • "a" < "b"
  • "aaa" < "aab"
  • "abc" < "abcd"

还有:

  • "000" < "001"
  • "010" < "011"
  • "100" < "101"

但是例如:

  • "2" > "10"

因为 "2" 在字母顺序上晚于 unicode 中的 "1"