This is my schema and I want to set the role to enum
@Prop({ required: true })
name: string;
@Prop({ required: true })
email: string;
@Prop({ required: true })
password: string;
@Prop()
role: string;
This is how I used to do in mongoose
role: {
type: String,
enum: roles,
default: 'user',
}
const roles = ['user', 'admin'];