Skip to content

Instantly share code, notes, and snippets.

@bnoguchi
Created May 3, 2011 09:19
Show Gist options
  • Save bnoguchi/953059 to your computer and use it in GitHub Desktop.
Save bnoguchi/953059 to your computer and use it in GitHub Desktop.
How to access enumValues in mongoose from a Model or Document
var mongoose = require('./index')
, TempSchema = new mongoose.Schema({
salutation: {type: String, enum: ['Mr.', 'Mrs.', 'Ms.']}
});
var Temp = mongoose.model('Temp', TempSchema);
console.log(Temp.schema.path('salutation').enumValues);
var temp = new Temp();
console.log(temp.schema.path('salutation').enumValues);
@toryrory
Copy link

thank you a lot!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment