对多个字段AngularFire查询 [英] AngularFire query on multiple fields
问题描述
我的工作,需要从火力地堡上的多个字段 选择数据的项目。
I'm working on a project which needs to select data from Firebase on multiple fields.
我有一个火力点数据库是这样的:
I have a firebase database like this:
[{
date: "2016-01-29"
done: false
task: "hello world"
},
{
date: "2016-01-29"
done: false
task: "hello world"
}]
现在我想查询是日期今天,所有的数据的完成是真实的。
Now I want to query all data with date is today and done is true.
我环顾四周谷歌一段时间,但没有什么工作。没有任何人能请帮我算出这个?
I look around google for a while but there's nothing work. Is there any one can please help me to figure this out?
推荐答案
您只能在具有火力地堡查询单个属性查询。因此,无论你需要做的过滤客户端的其余部分,或者你就必须将值组合成一个单一的date_done'属性。
You can only query on a single property with Firebase queries. So either you'll have to do the rest of the filtering client-side or you'll have to combine the values into a single 'date_done' property.
[{
date: "2016-01-29",
done: false,
date_done: "2016-01-29_false",
task: "hello world1"
},
{
date: "2016-01-29",
done: false,
date_done: "2016-01-29_false",
task: "hello world"
}]
现在,你可以得到所有的1月29日完成了与查询:
Now you can get all the queries that were done on January 29 with:
ref.orderByChild('date_done').equalTo('2016-01-29_true').on(...
有关的人谁问类似的问题更多信息,请参见:
For some more information from people who asked similar questions, see:
- NoSQL数据库设计与多重限制(火力地堡) 查询
- Query基于多凡在火力条款
- Firebase - 如何写多个orderByChild提取数据 ?
- How做在火力地堡下面的查询? (不止一个WHERE条件)
- Filter产品在火力地堡 多个子属性
- NoSQL database design for queries with multiple restrictions (Firebase)
- Query based on multiple where clauses in firebase
- Firebase - How do I write multiple orderByChild for extracting data?
- How to do the following query in Firebase? (more than one where condition)
- Filter products on multiple child properties in Firebase
这篇关于对多个字段AngularFire查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!