Cloud Firestore 中的 SQL LIKE 运算符? [英] SQL LIKE operator in Cloud Firestore?

查看:22
本文介绍了Cloud Firestore 中的 SQL LIKE 运算符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Firebase Real Time Fatabase 有一段时间了,今天我遇到了 Cloud Firestore.我不知道如何在 Firestore 上使用 LIKE 运算符.

I have been using Firebase Real Time Fatabase for a while and I come across Cloud Firestore today. I can't figure out on how to use LIKE operator on Firestore.

Firebase 实时数据库

Firebase Real Time Database

ref.child('user').orderByChild('name').startAt(name).endAt(name+'uf8ff')

在 Cloud Firestore 上,我尝试过

On Cloud Firestore, I have tried

userRef.where('name', '>=', name); <br>
userRef.where('name', '<=', name);

但它不起作用.

推荐答案

要解决这个问题,您需要将 orderByChild 函数更改为 orderBy.所以请使用以下代码:

To solve this, you need to change orderByChild function with orderBy. So please use the following code:

ref.collection('user').orderBy('name').startAt(name).endAt(name+'uf8ff')

这篇关于Cloud Firestore 中的 SQL LIKE 运算符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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