The Mongoose docs suggest overriding the default value of [] for an array field like this:
new Schema({
toys: {
type: [ToySchema],
default: undefined
}
});
I'd like to have an array of strings, with an enum and with a default value if none is supplied.
Thus, every document has type 'foo' if none is specified, but documents may be 'foo' and 'bar'.
Is that possible?