Firestore查询操作字符串如何处理不同的数据类型? [英] How does Firestore query operation strings treat different data types?

查看:72
本文介绍了Firestore查询操作字符串如何处理不同的数据类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Firestore 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数据类型,这很容易解释,但是对于其他数据类型呢? stringbooleanobjectarraynulltimestampgeopointreference

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的所有用户吗?例如barfoobarbarbaz

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆