dammy
With the below code, I want to fetch 1.0 without getting a response of Bad: element
TypeScript
dynamic appVersionFetch = await appWriteLogicExtender.databases
.listDocuments(
databaseId: "app_data",
collectionId: "app_version",
queries: [
Query.equal('app_version', ["app_version_key"]),
]);
newAppVersion = appVersionFetch.documents.first.data["app_version_id"];
TL;DR
The user was trying to fetch data using the `listDocuments()` function but was receiving a response of "Bad: element." The solution to the problem was to remove the index key from the query and allow it to be used automatically. Additionally, the user should ensure that they pass the correct value in the query instead of just the key. Here is the corrected code:
```dart
dynamic appVersionFetch = await appWriteLogicExtender.databases
.listDocuments(
databaseId: "app_data",
collectionId: "app_version",
queries: [
Query.equal('app_version', value),
]);
new dammy
this is the indexing pattern used
dammy
fetch data via listDocumenta()
Drake
you don't pass the index key...it's used automatically
Drake
you're supposed to put the value in the query
dammy
okay, that's 1.0 in the query? @Steven
dammy
I appreciate you Sir @Steven
safwan
[SOLVED] fetch data via listDocuments()
Recommended threads
- How to Avoid Double Requests in function...
I'm currently using Appwrite's `functions.createExecution` in my project. I want to avoid double requests when multiple actions (like searching or pagination) a...
- Edit ID of an existing collection
Hi there. Is it possible to edit an ID of an existing collection? Right now it looks impossible from AppWrite cloud at least.
- Current User is Not authorized
recreating same Thread