I am trying to fetch a list from firebase that has an array of email addresses. I only want the items that matches the email in the query. Here is the structure. I am trying to fetch items that match test1@gmail.com
under collaborators
The query:
this.firebase.list('/todo', {
query: {
orderByChild: 'collaborators',
equalTo: 'test1@gmail.com'
}
}).subscribe((data)=>{
console.log(data);
});
This return empty array which is supposed to list one item!
How do I solve this..
Solution:
let results = this.firebase.list('/todo')
.map(data => data.filter( (e) => {
return e.collaborators.indexOf(email) > -1;
}
));
return results