♥ 0 |
ANSWERED
Marked as spam
|
2 Replies
Private reply
Hi Stefan, You can use the “filter” object when calling the query method of the document object. It accepts the following parameters: – count: how many documents in total verify the query conditions For example: var documents = require("document"); const MAX_PAGES = 5; // ask to load all documents in my store but only return first 5 documents queryResponse = documents.query({ "query" : '', "fields" : "*", count : "true", resultsPerPage : MAX_PAGES }); // display results, i.e. 5 documents, in the console console.log("PAGE 1 n" + JSON.stringify(queryResponse.result.documents)); if (queryResponse.result.count > 0 && queryResponse.result.count > MAX_PAGES) { // if more than 5 documents are available that satisfy our query condition, ask to load the next page (page 2) queryResponse = documents.query({ "query" : '', "fields" : "*", count : "true", pageNumber : 2, resultsPerPage : MAX_PAGES }); // display next 5 documents in the console console.log("PAGE 2 n" + JSON.stringify(queryResponse.result.documents)); } Hope this helps. Regards, Julien Mrad Scriptr.io Marked as spam
|
|
Private reply
With query cursors in Cloud Firestore, you can part information returned by a query into clumps as indicated by the parameters you characterize in your query. Query cursors characterize the begin and end focuses for a query, enabling you to: Restore a subset of the information. Paginate query comes about. Utilize the startAt() or startAfter() strategies to characterize the begin point for a query. The startAt() strategy incorporates the begin point, while the startAfter() technique avoids it. You can likewise pass a documented snapshot to the cursor statement as the begin or end purpose of the query cursor. The qualities in the document snapshot fill in as the qualities in the query cursor. Elizabeth Marked as spam
|