Back

Query.equal("user_id", userId) is not working

  • 0
  • Web
  • Cloud
iamdipankar
8 Apr, 2024, 15:29

I am using Appwrite to get a list of documents

async getAllBoards(userId) { const queries = [Query.equal("user_id", userId)]; try { return await this.databases.listDocuments( env.appwriteDbId, env.appwriteBoardsColId, queries ); } catch (error) { console.log("Appwrite serive :: getAllBoards :: error", error); return false; } }

but i am getting invalid query. why??

Appwrite serive :: getAllBoards :: error AppwriteException: Invalid query: {"method":"equal","attribute":"user_id","values":["65fbe64139c7b14ffbfc"]} at Client.<anonymous> (http://localhost:5173/node_modules/.vite/deps/appwrite.js?v=8491bc89:883:17) at Generator.next (<anonymous>) at fulfilled (http://localhost:5173/node_modules/.vite/deps/appwrite.js?v=8491bc89:488:24)

I am using appwrite cloud and appwrite SDK v14

TL;DR
The developer is having trouble with the Query.equal("user_id", userId) function in their getAllBoards method while using the Appwrite SDK v14 for Appwrite Cloud. The error suggests using SDK v13 instead of v14 to fix the issue.
Guille
8 Apr, 2024, 15:32

For Appwrite Cloud you have to use the SDK v13

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more