Back

How can I query for pref in Teams

  • 1
  • Functions
  • Cloud
Ankit Maniya
13 Mar, 2025, 16:03

for example in teams' pref i have pref = { "code": "CDJKUE" }

I have created query like below

TypeScript
TeamList teamList = await teams.list(queries: [
    Query.equal("prefs", ["CDJKUE"])
  ]);

type of queries in teams is {List<String>? queries} {"error":"AppwriteException: general_argument_invalid, Invalid queries param: Invalid query: Attribute not found in schema: prefs (400)"}

TL;DR
Developers want to query for prefs in Teams but are getting an error because the attribute 'prefs' is not found in the schema. To find the team name based on prefs data code, the correct query should be: ``` TeamList teamList = await teams.list(queries: [ Query.equal("prefs.data.code", ["CDJKUE"]) ]); ```
Ankit Maniya
13 Mar, 2025, 16:25

I want to find the team name from prefs data code

TypeScript
teamList:: {$id: 67d20cf6ed94dac54a81, $createdAt: 2025-03-12T22:38:47.201+00:00, $updatedAt: 2025-03-12T22:38:47.517+00:00, name: Rock Team, total: 1, prefs: {data: {code: GZFRD6}}}
Ankit Maniya
13 Mar, 2025, 16:26

in query does it support like Query.equal("prefs.data.code", ["CDJKUE"]);

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