@samwen/firestore-pagination
v1.0.1
Published
pagination for firebase firestore collection
Downloads
2
Maintainers
Readme
firestore-pagination
how to install
npm install @samwen/firestore-pagination --save
how to use
You will need generate private key under service accounts and save it as serviceAccount.json in the project root folder.
You can use the import-json.js to import books.json into your firestore database.
node import-json.js books.json
Copy/paste config file as config.js.
demo.js
- There are 3 examples under examples folders: demo.js, interactive.js and get-batch.js.
---------------------- batch no: 1 ----------------------
### page no 1
id, isbn, title
1: 00368, 1617291692, The Well-Grounded Rubyist, Second Edition
2: 00352, 1617291455, Ember.js in Action
3: 00349, 1617291412, The Joy of Clojure, Second Edition
4: 00289, 1617290629, CoffeeScript in Action
5: 00387, 1617292133, Learn SQL Server Administration in a Month of Lunches
### page no 2
id, isbn, title
1: 00186, 1935182994, EJB 3 in Action, Second Edition
2: 00350, 1617291420, iOS 7 in Action
3: 00358, 1617291560, Practical Data Science with R
4: 00324, 1617291021, Solr in Action
5: 00305, 1617290904, Play for Java
### page no 3
id, isbn, title
1: 00336, 1617291218, The Mikado Method
2: 00323, 1617291056, Kanban in Action
3: 00302, 1617290823, Mule in Action, Second Edition
4: 00341, 1617291307, Gradle in Action
5: 00291, 1617290491, HTML5 in Action
### page no 4
id, isbn, title
1: 00272, 1617290327, Ext JS in Action, Second Edition
2: 00365, 1617291374, Windows Phone 8 in Action
3: 00317, 1617290971, Learn Windows IIS in a Month of Lunches
4: 00301, 1617290394, Linked Data
5: 00306, 1617290920, Hello World! Second Edition
batch_key: 2x7xAh2OteQAorX33uvpYBeGdIZ-2wlXBxTHH4BCypr3FkFASqHbMibqnO
start_page_no: 1 has_prev: false has_next: true
metrics: {"read_docs":1,"write_docs":1,"delete_docs":0,"runtime":372}
for current batch: node demo.js 2x7xAh2OteQAorX33uvpYBeGdIZ-2wlXBxTHH4BCypr3FkFASqHbMibqnO
for next batch: node demo.js 2x7xAh2OteQAorX33uvpYBeGdIZ-2wlXBxTHH4BCypr3FkFASqHbMibqnO NEXT
batch_key: 9SVCj9yVtNQz9XhHyAvmBLe96jA-2wlXBxTHOTwmCC5ZKspLzfl06Nkbo8
start_page_no: 1 has_prev: false has_next: true
metrics: {"read_docs":1,"write_docs":1,"delete_docs":0,"runtime":382}
*** preview result: {"total":78,"cached_count":78}
metrics: {"read_docs":1,"write_docs":1,"delete_docs":0,"runtime":338}
Q Quit
C Redo current pages (default)
P Show previous pages
N Show next pages
batch_key: 9SVCj9yVtNQz9XhHyAvmBLe96jA-2r7nSAPOpSKJWv8EpruMm9jAmJekWghiMSF8gs
start_page_no: 5 has_prev: true has_next: true
metrics: {"read_docs":1,"write_docs":1,"delete_docs":0,"runtime":511}