索引时将文本值转换为小写

时间:2019-05-27 19:02:07

标签: google-cloud-firestore google-cloud-functions

任何想法在firestore函数中建立索引时如何将文本值转换为小写。我已经尝试过了

const newRef = db.collection("user").where("profile.companyName".toLowerCase(), ">=", data.value.toLowerCase())

但是这给我一个错误

"profile.companyName".toLowerCase()

是否有可能做到这一点?我真的不想将所有名称都保存为小写字母,以便能够正确索引我的名称然后将其大写。

1 个答案:

答案 0 :(得分:2)

Firestore没有API或机制为您执行此操作。您必须将字符串的小写版本存储在一个字段中,然后使用该字段进行查询。

相关问题