本文介绍了Cloud Firestore查询是否仍然区分大小写?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Firebase实时数据库以区分大小写的方式接受带有字符串的查询。
Firebase Realtime Database accept queries with strings in case sensitive manner.
这仍然适用于Firestore吗?
Does this still apply for Firestore?
推荐答案
是的,查询仍然区分大小写。
Yes, queries are still case sensitive.
要支持不区分大小写或任何其他规范化,您需要编写包含规范化版本并对其进行查询的单独字段。例如
To support case-insensitive or any other canonicalization you'll need to write a separate field that contains the canonicalized version and query against that. For example
db.collection("users").where("name", "=", "Dan")
db.collection("users").where("name_lowercase", "=", "dan")
另请参阅我的更长的答案:
Also see my longer answer here: Cloud Firestore Case Insensitive Sorting Using Query
这篇关于Cloud Firestore查询是否仍然区分大小写?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!