0

So I've been working in advanced queries with firebase and ionic, I have a data structure like this one:

enter image description here

I have several users in the profile branch, and I want to get a list of the users who have a given "asignatura" saved in the profile. For example if the parameter is algebra, then I'll get all the users who have algebra saved in the node asignaturas.

I have something like that in my code but i know it isn't working:

this.tutores = this.afDatabase.list(`profile`,{
  query:{
    orderByChild: 'asignaturas',
    equalTo: asignatura
  }
});

I'm not sure how to iterate inside the inner node.

I'd apreciate any help or suggestions

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • This is a categorization problem and you have a few problems in your data structure that make it impossible to query efficiently. Instead of repeating them, have a look at my answer here: http://stackoverflow.com/questions/40656589/firebase-query-if-child-of-child-contains-a-value – Frank van Puffelen Oct 15 '17 at 01:49
  • Thanks for answering, I'm gonna change my data structure then. – Daniel Esteban Ladino Torres Oct 15 '17 at 15:33

0 Answers0