Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

mongoose model enum

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

{
    type: String,
    enum: Role,
    default: Role.USER,
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #mongoose #model #enum
ADD COMMENT
Topic
Name
9+9 =