在 Firebase 中查询数据时是否还有类似 ~ 的运算符 [英] Are there any more operators like ~ when querying data in Firebase

查看:11
本文介绍了在 Firebase 中查询数据时是否还有类似 ~ 的运算符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到 firebase 文档中的~"符号 这里

I notice the '~' sign in the firebase documentation here

var ref = new Firebase("https://dinosaur-facts.firebaseio.com/dinosaurs");
ref.orderByKey().startAt("b").endAt("b~").on("child_added", function(snapshot) {
  console.log(snapshot.key());
});

是否还有其他表达式(如~")可以在 firebase 中使用?我很好奇是否有一个操作符像 .contains(string) 而不是获取所有然后过滤数据.我试图让自己远离弹性搜索.

are there other expressions like '~' that can be use in firebase? I'm curious if there's a operator that acts like .contains(string) rather than fetching all then filter the data. I'm trying to keep my self away from elastic search.

推荐答案

据我所知,Firebase API 中没有 .contains 这样的东西.

As far as I know, there is no such thing as .contains in the Firebase API.

最好的办法是编写一个实用函数来获取数据并为您过滤数据.

Your best bet is to write a utility function which fetches the data and filters it for you.

这篇关于在 Firebase 中查询数据时是否还有类似 ~ 的运算符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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