biny01
{ "message": "Invalid query: {method:equal,attribute:accountId,values:[660277c0b25c8e105e95]}", "code": 400, "type": "general_query_invalid", "version": "0.12.128" } this is my code export async function getCurrentUser() { try { const currentAccount = await getActiveSession();
TypeScript
if (!currentAccount) throw new Error("error getting currentAccount");
console.log(currentAccount, currentAccount.$id);
const currentUser = await database.listDocuments(Databaseid, userid, [
Query.equal("accountId", currentAccount.$id),
]);
console.log(currentUser);
if (!currentUser) throw new Error("error getting current user");
return currentUser.documents[0];
} catch (err) { console.log(err); } }
TL;DR
Appwrite query not functioning due to an invalid query error. The code is attempting to retrieve a user based on their accountId, but the query structure is incorrect. The error message "Invalid query" with code 400 is appearing. To solve this, modify the query structure to be valid and ensure it matches the database structure. Recommended threads
- Seed db
hello there... is this correct way to seed appwrite
- Query Appwrite
Hello, I have a question regarding Queries in Appwrite. If I have a string "YYYY-MM", how can I query the $createdAt column to match this filter?
- Different appwrite IDs are getting expos...
File_URL_FORMAT= https://cloud.appwrite.io/v1/storage/buckets/[BUCKET_ID]/files/[FILE_ID]/preview?project=[PROJECT_ID] I'm trying to access files in my web app...