Back

users.listMemberships() limited to 1000 memberships

  • 0
  • Self Hosted
  • Auth
zwelch
3 Sep, 2024, 13:17

Due to stupid (but unchangeable) requirements it is necessary that a user is in more than 1000 teams. In this particular case there are about 1300 teams. If I want to get all memberships of the user I only get 1000 back. Unfortunately, unlike other functions, I cannot pass queries to increase the limit. How can I get all memberships of the user?

` const { total, memberships } = await users.listMemberships("66a739de0022f7ecbf15");

console.log(total, memberships.length);`

1000 1000

TL;DR
Developers facing a limitation of 1000 memberships with users.listMemberships() in the Appwrite API. Suggestions include using the Teams API for pagination, passing queries into the listMemberships function, or finding a way to increase the limit in order to retrieve all memberships of a specific user. The provided code snippet shows that even though there are about 1300 teams, only 1000 are being returned.
Kenny
3 Sep, 2024, 13:19

You should be able to pass queries into the listMemberships function?

https://appwrite.io/docs/references/cloud/client-web/teams#listMemberships

Kenny
3 Sep, 2024, 13:19

Have you tried and it not work?

zwelch
3 Sep, 2024, 13:24

But I use the Users API and not the Teams API because I need all memberships of a specific user and not all users in a team.

darShan
3 Sep, 2024, 13:40

as Kenny suggested, why not use the Teams#listMemberships? It allows passing a userId, this should also allow pagination.

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