Is there an equivalent of startAt(value, [key])
in the REST API? Specifically the optional key param.
https://www.firebase.com/docs/web/api/query/startat.html
Details:
I am paging through a collection on a property (dueDate) using the REST API. Paging through works but, since the values for dueDate are not unique, each successive page may contain several duplicates. In the worst case, there may be more duplicates on a date than the page size, which would break the pagination.
Because of the way Firebase paging through works I'm expecting 1 duplicate, the last item from the previous page.
The JS SDK startAt method supports a second argument to provide the last key when making the next query but this does not appear to exist, or is not documented in the REST API.
Unhelpfully, the REST API docs do not provide a full specification for the query parameters, only the REST-specific params like "auth", and "shallow".
orderBy
See the section in the guide on ordered data for more information.
limitToFirst, limitToLast, startAt, endAt, equalTo
See the section in the guide on querying data for more information.
Docs: https://firebase.google.com/docs/reference/rest/database/#section-query-parameters
The request in NodeJS:
var request = require('request-promise');
var startAt = 0
var now = new Date().getTime(); // calculate once per paginated query
getPage(startAt, now)
// then process page
// then get the next page
// etc
function getPage(startAt, endAt, lastId) {
var params = {
auth: /* ... auth token ... */,
orderBy: '"dueDate"',
startAt: startDate, /* startDate is a Unix timestamp in milliseconds */
endAt: endAt,
limitToFirst: 1000
};
return request.get({
url: 'https://my-firebase.firebaseio.com/todos.json',
qs: params,
json: true,
timeout: 20000 /* ms */
});
}
I have looked at Firebase REST API: How to fetch data by priority like startAt/endAt in JS?. The newer answer refers to the old docs, which as stated above, do not answer this question unless I have missed something. I have read everything in the REST sections in both the old docs and the new docs pages.