Can I get the nth item of a firebase "query"? -


firebase has basic query functionality orderby*, limitto*, startat.., etc... there way tell firebase want 10th result of request? example, using orderbykey. since keys these awesome magical strings, cannot use integers reference position within them. store pointer location in keys , move through it. want orderbykey, , arbitrarily key n. possible?

while cannot access child items index firebase, can store key of item , use start next query.

var ref = new firebase('https://yours.firebaseio.com/items'); var lastknownkey = null; var firstquery = ref.orderbykey().limittofirst(100); firstquery.once('value', function(snapshot) {   snapshot.foreach(function(childsnapshot) {     lastknownkey = childsnapshot.key();   }); }); 

now have variable lastknownkey has last key you've ever seen. next batch of children, pass value in startat():

var nextquery = ref.orderbykey().startat(lastknownkey).limittofirst(100); 

Comments