I am trying to create and use an enum type in Mongoose. I checked it out, but I'm not getting the proper result. I'm using enum in my mongoose schema as follows:
var RequirementSchema = new mongoose.Schema({
status: {
type: String,
enum : ['NEW', 'STATUS'],
default: 'NEW'
},
})
But I am a little bit confused here, how can I put the value of an enum like in Java NEW("new"). How can I save an enum into the database according to its enumerable values? I am using it in express node.js.