I'm trying to define a mongoose schema where I have a mixed type but want to make some properties required while still allowing anything there. Is this event possible?
new Schema({
myProperty: {
name: {
type: String,
required: true,
}
<anything else>
}
})
Only pseudo solution I found was to define property level where I can have a mixed type, but I would like to avoid it:
new Schema({
myProperty: {
name: {
type: String,
required: true,
}
additionalData: Object,
}
})