Back

List Users does not list all users

  • 0
  • Users
  • Functions
  • Cloud
sswastik02
27 Dec, 2023, 07:21

Here is the code:

TypeScript
  let users = new Users(client)
  let userList = await users.list()
  log(userList)
  log(userList.users)
  log(userList.users.length)
  log(userList.users.map(user=>user.$id))

The output however is

TypeScript
{"total": 201, "users": [{$id: .......
[{$id: ........
25
[........

As you can see, the total is 201 but userList.users.length = 25

I am executing this in cloud in functions

TL;DR
The user is experiencing an issue where the "List Users" feature is not listing all users. The issue description is simply "undefined." Unfortunately, there is no solution provided in the support thread.
sswastik02
27 Dec, 2023, 07:24

I believe, it limits to 25, How can i bypass this limit ?

sswastik02
27 Dec, 2023, 07:29

does anyone know ?

D5
27 Dec, 2023, 09:58

Default query limit is 25, that's why you don't get more than 25 elements

D5
27 Dec, 2023, 10:03

So you need to pass a query like this:

TypeScript
const promise = users.list(
  [
    Query.limit(300),
  ]
);
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