【问题标题】:Are there any more operators like ~ when querying data in Firebase在 Firebase 中查询数据时,是否还有像 ~ 这样的运算符
【发布时间】:2015-06-24 12:29:13
【问题描述】:

我注意到 firebase 文档 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) 而不是获取所有然后过滤数据。我试图让自己远离弹性搜索。

【问题讨论】:

  • 波浪号 (~) 不是任何特定的运算符。它只是一个字符,恰好在 ASCII 图表中高于 key 中使用的所有其他字符。同样,您可以使用空格或 bang (!) 作为 ASCII 图表中早期的字符:asciitable.com

标签: javascript firebase ionic-framework angularfire


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-24
    • 2010-10-05
    • 2012-11-25
    • 2010-09-22
    相关资源
    最近更新 更多