I'm almost sure that my question has no solution using just firebase, but let me try. I have to get a specific node ordering it by another value, explaining better: I have to get all children "empregado" ordering them by "data". This is my data:
"ponto" : {
"-KEggOdWvibrLfpptyfX" : {
"data" : "04/04/2016",
"empregado" : "-KEHl6qtSG7UkZU8Gi4t",
"entradaM" : "07:03",
"entradaT" : "12:01",
"equipe" : "-KDYYDYMqc0l0irnOGjP",
"horas" : "09:00",
"horas100" : "",
"horas50" : "",
"obra" : "-KDcuiLXj8IgVB5RalLS",
"observacao" : "tsts",
"saidaM" : "11:01",
"saidaT" : "17:00"
},
"-KEggYHd7bBkv04XSx2C" : {
"data" : "05/04/2016",
"empregado" : "-KEHl6qtSG7UkZU8Gi4t",
"entradaM" : "07:01",
"entradaT" : "12:02",
"equipe" : "-KDYYDYMqc0l0irnOGjP",
"horas" : "09:00",
"horas100" : "",
"horas50" : "01:00",
"obra" : "-KDcuiLXj8IgVB5RalLS",
"observacao" : "tsts",
"saidaM" : "11:01",
"saidaT" : "18:00"
},...more data with repeated key "empregado" and not repeated too
So, I did:
ref.child("ponto").orderByChild("empregado").equalTo("-KEHl6qtSG7UkZU8Gi4t").on("child_added", function(snapshot) {
ponto = snapshot.val();});
and perfectly I got the data, but I need to order it by child "data", so I thought this could be solved by something like that:
ref.child("ponto").orderByChild("data").orderByChild("empregado").equalTo("-KEHl6qtSG7UkZU8Gi4t").on("child_added", function(snapshot) {
ponto = snapshot.val();});
But It says that I can't use twice "orderByChild" Ideas??? Thanks since now.