the default it 25 records, how to get more or less?
I tried this code but it didn't work:
TypeScript
"use server";
const sdk = require("node-appwrite");
const client = new sdk.Client()
.setEndpoint(process.env.NEXT_PUBLIC_CMS_ENDPOINT)
.setProject(process.env.NEXT_PUBLIC_CMS_PROJECT)
.setKey(process.env.CMS_APIKEY);
const databases = new sdk.Databases(client);
export async function getReportData(documentID) {
const limit = 2;
let offset = 0;
let allResults = [];
let result;
try {
do {
result = await databases.listDocuments(
process.env.DB_ID,
process.env.NEXT_PUBLIC_VNG_CLAIMS,
[
sdk.Query.limit(limit),
sdk.Query.offset(offset)
]
);
allResults = allResults.concat(result.documents);
offset += limit;
} while (result.documents.length === limit);
return allResults;
} catch (e) {
throw new Error(e.message);
}
}
TL;DR
To adjust the number of records retrieved, you can set the limit in the code snippet provided. Update the 'limit' variable to the desired number of records.Recommended threads
- Subscription Problem
I'm making an app in RN with Expo and Appwrite and there's a functionality which allows the user to create a task/test (i'll be reffering to them collectively a...
- "Waiting" executions
For my React Native App, I have had no issues deploying a function in Appwrite & the executions either working or failing. Now I am getting status code - 0 & j...
- Auth Issue (maybe?)
Hi there, I'm relatively new to programming and am following a tutorial on youtube just to get an idea of how this all is suppossed to work. Now Im setting up t...