I am dealing with how to create and used enum object in mongoose. i checked it out,i am not getting any proper result. i am using enum in my program like this :)
My schema is
var RequirementSchema = new mongooseSchema({
status: {
type: String,
enum : ['NEW,'STATUS'],
default : 'NEW'
},
})
But i am little bit confuse here,how can i put value of enum like in java NEW("new"). How can i save enum in database according to it's value. i am using it in express nodejs
The enums here are basically String objects. Change the enum line to enum: ['NEW', 'STATUS'] instead. You have a typo there with your quotation marks.