
I'm following the docs,
https://appwrite.io/docs/pagination#cursor-pagination, so do I need to write the code again and again for each page?
And I'm getting an error saying Cannot read properties of undefined (reading 'length')
this is my function
"647ac763cf53edxxxxx",
"647ac820ba3852xxxxx",
[
Query.orderDesc("age"),
Query.notEqual("age", ["invalid"]),
Query.limit(25)
]
);
const lastId = page1.documents[page1.documents.length - 1].$id;
// Page 2
const page2 = databases.listDocuments(
'647ac763cf53edxxxxx',
'647ac820ba3852xxxxx',
[
Query.limit(25),
Query.cursorAfter(lastId),
]
);
page1.then(function (response) {
console.log(response.documents);
var tableHTML = generateTable(response.documents);
var tableContainer = document.getElementById('tableContainer');
tableContainer.innerHTML = tableHTML;
}, function (error) {
console.log(error);
});
page2.then(function (response) {
console.log(response.documents);
var tableHTML = generateTable(response.documents);
var tableContainer = document.getElementById('tableContainer');
tableContainer.innerHTML = tableHTML;
}, function (error) {
console.log(error);
});```

I highly suggest you do some research or tutorials on promises to understand how they work and how to use them

I solved my error, thanks🫡
Recommended threads
- React native app login via Safari
Hi! I deployed for debug my React Native app in web, chrome everythink works well but in safari on mac and ios I cant login. I found this one error in safari co...
- Relationships restricted to a max depth ...
When I do query like: ``` await _databases.listDocuments( databaseId: AppwriteConfig.DATABASE_ID, collectionId: AppwriteConfig.SERVICES_COLLECTI...
- How can we add more than 8 attributes in...
Hey, when I tried to add attribute in my collection it showed me this Error "The maximum number or size of attributes for this collection has been reached." How...
