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

时间:2018-03-27 03:52:02

标签: firebase operators google-cloud-firestore

Firestore查询方法中的where opStr(操作字符串)如何处理不同的数据类型?

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

对于number数据类型,它是非常自我解释的,但对于其他数据类型怎么样? stringbooleanobjectarraynulltimestampgeopointreference

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

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

是否有人知道此特定主题的任何文档?

1 个答案:

答案 0 :(得分:1)

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

一些例子:

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

还有:

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

但是例如:

  • "2" > "10"

由于"2"按字母顺序晚于unicode中的"1"