1var userSchema = new mongooseSchema({
2 userType: {
3 type: String,
4 enum : ['user','admin'],
5 default: 'user'
6 },
7})
8
9
1enum Role {
2 ADMIN = 'ADMIN',
3 USER = 'USER'
4}
5
6{
7 type: String,
8 enum: Role,
9 default: Role.USER,
10}
11