Back

How can I search on `userName` when listing team memberships?

  • 0
  • Web
deep-printerverse
5 Apr, 2024, 09:54

Hello, I was trying to use teams.listMemberships method in JavaScript SDK and I wanted to search by userName attribute. I tried two ways to search on the name:

  1. The search parameter in the listMemberships method. This parameter looks like it only searches on the ID and not user name.
  2. Query.search("userName", search) gives an error appwrite.js?v=76cc79fe:850 Uncaught (in promise) AppwriteException: Invalid queries param: Invalid query: Attribute not found in schema: userName.

How can I search on userName then? What is the attribute for teams which holds the userName? Thank you

TL;DR
To search by `userName` when listing team memberships using the Appwrite JavaScript SDK: - The `teams.listMemberships` method does not support searching by `userName`. - Use the `teams.listMemberships` method to retrieve a list and then filter locally by `userName`. - The `Query` class method does not work for searching by `userName`. - The attribute for teams holding `userName` may not be directly searchable in this context.
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