Query users by role on Skygear Cloud Database


#1

Hi Team,

Is there a way that I can query for users with a certain role? For instance, if I wanted to query for all users who have the role “admin”, how would I do that?

I tried this

query.containsValue('roles', 'admin')

on a User model query, but I get an error saying that “roles” doesn’t exist on users.

I’m using the JavaScript SDK with a locally deployed version of skygear-server. Any help is appreciated. Thanks!


#2

@astone123 Currently there are no APIs for query users from role. May I know more about your use case?

If you’re doing something like a user group, we suggest separating the auth from group in the database structure.