javascript - Firebase querying when combining orderByChild startAt and limitToFirst -
i'm trying set firebase query implement pagination me. similar this: https://www.firebase.com/blog/2013-10-01-queries-part-one.html#paginate
my problem when try combine 3 methods mentioned above. example, 1 of ref's looks this: userref = ref.child('users').orderbychild('email').startat(null, end.id).limittofirst(number(limit))
so have users list. want ordered alphabetically email. want new query start @ last entry of old query. lastly want limit amount of children returned number 4.
now when combine 2 of these methods such startat , limittofirst in other lists, query works expected. unfortunately depends on list being presorted in firebase already. happens user query firebase returns first limit number of children always. it's ignoring startat part. i've tried hardcoding in keys , goes ignored.
i know can tell firebase sort entries using indexon rules , if have reconstruct database last resort (i implemented indexon after made users). feel should able work without indexon, don't see why shouldn't.
my data structure going like:
root:{ users:{ 01d1d38d-c780-4c5e-8537-a74432dea86e:{ email:example@gmail.com, questions: {}, comments: {} } }
is there way of accomplishing query properly? there reason why can't construct query way?
Comments
Post a Comment