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

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

问题描述

我使用Firebase Real 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天全站免登陆