📅  最后修改于: 2022-03-11 15:01:17.761000             🧑  作者: Mango
var mongoose = require('./index');
PersonSchema = new mongoose.Schema({
name: {type: String, required: true},
gender: {type: String, enum: ['Male', 'Female', 'Others']}
});
var PersonModel = mongoose.model('Person', PersonSchema);
console.log(PersonModel.schema.path('gender').enumValues);
// ['Male', 'Female', 'Others']