Need Help! I am writing the code below
TypeScript
Client client = FFAppState().appwriteClient;
Databases dbInstance = Databases(client);
DocumentList homesList = await dbInstance.listDocuments(
databaseId: FFAppConstants.dbInstance,
collectionId: FFAppConstants.homesCollection,
);
print('homesList => ${homesList.documents}');
return homesList.documents;
I am just getting the Instance not data, when I print it.
TL;DR
Developers are having trouble getting document list data using `listDocuments` method. The code just returns the instance not the data when printed.
Solution:
Make sure to use the `data` property of the `DocumentList` object to access the actual documents. Update the code like this:
```
Client client = FFAppState().appwriteClient;
Databases dbInstance = Databases(client);
DocumentList homesList = await dbInstance.listDocuments(
databaseId: FFAppConstants.dbInstance,
collectionId: FFAppConstants.homesCollection,
);
print('homesList => ${homesList.data}'); // Use data@darShan need help
Recommended threads
- Unable to create records with other user...
are we able to create records in collections with permissions of different user than the caller of this request? (with document security on) I have backend func...
- 500 Internal Error when Project is opene...
After migrating from 1.6.1 to 1.7.4 I noticed this strange behaviour: When I open a project in a separate tab I get a 500 internal error. However, then I simpl...
- New attribute stuck on processing?
I was running out of disk space and after creating an attribute and restarting my appwrite (self hosted) I have an attribute stuck on creation. Any way to remov...