This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* listDocumentsPaginated | |
* Takes a collectionId, lastId, queries, and limit and returns a list of documents | |
* It's very important to note, if it's the first request, do not pass in a lastId, if it's not the first request, pass in the lastId | |
* Otherwise known as the current last document's ID in the paginated list | |
* | |
* This is best for dynamic lists or LARGE amounts of data | |
*/ | |
const listDocumentsPaginated = async (collectionId: string, lastId?: string, queries: string[] = [], limit: number = 25, forward: boolean = true): Promise<{ type: "success" | "error", message: string, data: Models.DocumentList<Models.Document>}> => { | |
try { |