Currently, I'm working with AngularJS and Firebase and facing an issue when trying to retrieve the first child from a filtered set of children. Interestingly, using limitToFirst(1) doesn't seem to accomplish this, unlike the .child("=KDhddgd47nd") method.
Here's an example snippet of my code:
var Sport = new Firebase(FirebaseUrl);
var Teams = Sport.child("teams");
var myTeam = Teams.child("Saints");
var myPlayers = myTeam.child("players").orderByChild("name");
var myFixtures = myTeam.child("fixtures").startAt(now).orderByChild("date");
After this, I have a collection of fixtures, stored in myFixtures.
*var myFirstFixture = myFixtures.child("-KDUNN5KRNUmLlOhUB4D");*
This line successfully retrieves the fixture whose id is -KDUNN5KRNUmLlOhUB4D
However,
var myFirstFixture = myFixtures.limitToFirst(1);
does not yield the same result. In fact, it doesn't retrieve any fixture at all.
One would expect it to, wouldn't they?