Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Indexing 如何在firebase中使用索引编写查询?_Indexing_Firebase_Angularjs Orderby - Fatal编程技术网

Indexing 如何在firebase中使用索引编写查询?

Indexing 如何在firebase中使用索引编写查询?,indexing,firebase,angularjs-orderby,Indexing,Firebase,Angularjs Orderby,我想使用firebase中的索引来检查是否存在状态为true的包。这可能是阅读以下内容的好时机: packages:{ pack-a : "true", pack-b : "true", pack-c : "false", pack-d : "true", pack-e : "true", } var ref = new Firebase('https://yours.firebase

我想使用firebase中的索引来检查是否存在状态为true的包。

这可能是阅读以下内容的好时机:

packages:{
           pack-a : "true",
           pack-b : "true",
           pack-c : "false",
           pack-d : "true",
           pack-e : "true",
}
var ref = new Firebase('https://yours.firebaseio.com/packages');
var query = ref.orderByValue().equalTo('true');

query.on('value', function(snapshot) {
  console.log('Are there packages? '+snapshot.hasChildren());
});