Answers for "mongoose model enum"

4

enum in mongoose

var userSchema = new mongooseSchema({
   userType: {
        type: String,
        enum : ['user','admin'],
        default: 'user'
    },
})
Posted by: Guest on May-17-2021
0

mongoose model enum

enum Role {
  ADMIN = 'ADMIN',
  USER = 'USER'
}

{
    type: String,
    enum: Role,
    default: Role.USER,
}
Posted by: Guest on May-14-2021

Code answers related to "TypeScript"

Browse Popular Code Answers by Language