I would like to define a filed 'lines' as an Array of values which can be of different types ( numbers or strings or boolean or dates )
when I try :
lines: [
{
type: String,
content: Mixed
}
]
I get an ESLint error error : Mixed is not defined
Should I write ?
const Schema = mongoose.Schema;
...
lines: [
Schema.Types.Mixed
]
According to mongoose documentation you can use Mixed schema type as follows
var schema = new Schema({
ofMixed: [Schema.Types.Mixed],
})
// example use
var Thing = mongoose.model('Thing', schema);
m.ofMixed = [1, [], 'three', { four: 5 }];
m.save(callback);