Answer the question
In order to leave comments, you need to log in
How to get (filter) a specific number (from/to) of Firebase Realtime Database records?
Is there a way to filter posts from the Firebase database, for example by tag, so that posts from 5 to 10 are selected (for pagination)?
Here is the structure of the database:
Here is the query:
loadPostsByTag(tag) {
return this._database
.ref("/portfolio/")
.orderByChild("tags/" + tag)
.equalTo(true)
.limitToFirst(5)
.once("value")
.then((snap) => Object.values(snap.val()));
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question