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
- Need help in email verification - react ...
Hi, i am trying to verify user, but it is asking me a redirect link, and as i am creating an mobile app, i want it to be done in the app itself. Please if anybo...
- Project stuck in read-only mode on free ...
Hi Appwrite team! I’m a student using the free plan, and my project (ID: 68e48f780001232ad879) is currently stuck in read-only mode. I can’t create or update ...
- Insights🐛 Bug Report: Missing Tables AP...
Hi. First time appwrite user. i'm building a new mobile app with react-native & expo and decided to use appwrite as a tech for this app. i found the react-nativ...