So I'm trying to make a simple GET API that should list all Users with a role:'admin' This is mongoose Schema for User:
const userSchema = new mongoose.Schema(
{
username: {
type: String,
lowercase: true,
minlength: 3,
maxlength: 20,
required: true
},
role: {
type: String,
enum: ['admin', 'doctor'],
required: true
}});
But I have no idea how to get value 'admin' from role.