{"id":15294859,"url":"https://github.com/bookcreator/firebase-database-pagination","last_synced_at":"2026-01-05T07:51:33.015Z","repository":{"id":37084444,"uuid":"290195646","full_name":"bookcreator/firebase-database-pagination","owner":"bookcreator","description":"Firebase Pagination","archived":false,"fork":false,"pushed_at":"2023-06-19T11:57:21.000Z","size":1028,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-01T03:47:03.360Z","etag":null,"topics":["firebase","firebase-database","nodejs","pagination"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bookcreator.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-25T11:24:16.000Z","updated_at":"2022-03-16T13:33:59.000Z","dependencies_parsed_at":"2024-09-30T17:15:43.751Z","dependency_job_id":"85f850a7-a367-4099-97a8-031838e35717","html_url":"https://github.com/bookcreator/firebase-database-pagination","commit_stats":{"total_commits":50,"total_committers":2,"mean_commits":25.0,"dds":"0.16000000000000003","last_synced_commit":"096b7161cafeb4c4b8d1001d4d246cad74d7ad25"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bookcreator%2Ffirebase-database-pagination","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bookcreator%2Ffirebase-database-pagination/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bookcreator%2Ffirebase-database-pagination/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bookcreator%2Ffirebase-database-pagination/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bookcreator","download_url":"https://codeload.github.com/bookcreator/firebase-database-pagination/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245319978,"owners_count":20596080,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["firebase","firebase-database","nodejs","pagination"],"created_at":"2024-09-30T17:07:39.937Z","updated_at":"2026-01-05T07:51:33.011Z","avatar_url":"https://github.com/bookcreator.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Firebase Database Pagination \n[![Node.js CI](https://github.com/bookcreator/firebase-database-pagination/workflows/Node.js%20CI/badge.svg)](https://github.com/bookcreator/firebase-database-pagination/actions?query=workflow%3A%22Node.js+CI%22)\n\nAllows pagination for the Firebase RTDB.\n\n## Usage\n\nAll the normal methods return an array of [`DataSnapshot`s](https://firebase.google.com/docs/reference/admin/node/admin.database.DataSnapshot).\n\n### Keys\n\nTo paginate over all the keys of a node you can use:\n\n```js\nconst pagination = require('firebase-database-pagination')\nconst admin = require('firebase-admin').initializeApp()\n\nconst children = await pagination.key(admin.database().ref('node'), 10)\n```\n\nThis will fetch all children of `node` in batches of 10.\n\n\n### Value\n\nTo paginate over keys order by the nodes value you can use:\n\n```js\nconst pagination = require('firebase-database-pagination')\nconst admin = require('firebase-admin').initializeApp()\n\nconst children = await pagination.value(admin.database().ref('node'), 10)\n```\n\n\n### Child\n\nTo paginate over all the keys of a node order by a childs key you can use:\n\n```js\nconst pagination = require('firebase-database-pagination')\nconst admin = require('firebase-admin').initializeApp()\n\nconst children = await pagination.child(admin.database().ref('node'), 'childKey', 10)\n```\n\n## Transform parameter\n\nThe `.key`, `.value` and `.child` methods have a `.transformed` function property which allows each result to be converted to something else if needed.\n\nThe `transformer` parameter can return a value or a promised value.\n\n```js\nconst pagination = require('firebase-database-pagination')\nconst admin = require('firebase-admin').initializeApp()\n\nconst values = await pagination.key.transformed(admin.database().ref('node'), 10, nodeChildSnapshot =\u003e {\n   return { key: nodeChildSnapshot.key, value: nodeChildSnapshot.child('count') }\n})\n// values is an array of { key, count }\n\nconst values = await pagination.key.transformed(admin.database().ref('node'), 10, async nodeChildSnapshot =\u003e {\n   return await admin.database().ref('other').child(nodeChildSnapshot.key)\n})\n// values is an array of DataSnaphots pointing at /other/\u003cnodeChildKey\u003e\n```\n\n## Stopping iteration early\n\nThe `.key`, `.value` and `.child` methods have a `.forEach` function property which allows iteration in a similar maner to `DataSnapshot#forEach`, returning a truthy value to stop iteration early.\n\n```js\nconst pagination = require('firebase-database-pagination')\nconst admin = require('firebase-admin').initializeApp()\n\nconst stopped = await pagination.key.forEach(admin.database().ref('node'), 10, nodeChildSnapshot =\u003e {\n   return nodeChildSnapshot.child('valid').exists()\n})\n// stopped will be true if any child node had a `valid` child.\n```\n\n## Limiting the query\n\nAll of the methods except a parameter to return a subset of values.\n\n```js\nconst pagination = require('firebase-database-pagination')\nconst admin = require('firebase-admin').initializeApp()\n\n// Return all keys where the value is equal to 10\nawait pagination.value(admin.database().ref('node'), 10, { equalTo: 10 })\n\n// Return all keys where the value is greater then or equal to 10\nawait pagination.value(admin.database().ref('node'), 10, { startAt: 10 })\n\n// Return all keys where the value is less then or equal to 20\nawait pagination.value(admin.database().ref('node'), 10, { endAt: 20 })\n\n// Return all keys where the value is greater then or equal to 15 AND less than or equal to 25 (i.e. in the interval [15, 25])\nawait pagination.value(admin.database().ref('node'), 10, { startAt: 15, endAt: 25 })\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbookcreator%2Ffirebase-database-pagination","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbookcreator%2Ffirebase-database-pagination","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbookcreator%2Ffirebase-database-pagination/lists"}