I have a structure like this
alerts: {
[symbol: string]: [
{
alert_price: number,
price_when_set: number,
}
]
},
how do i declare the above in a mongoose schema as the key value for the object is variable.
Can i just use alerts: [Object]
or alerts: [Schema.Types.Mixed]
and use all kinds of objects within? or is there a better solution.
Thanks in advance!
Well after a lot of testing, I figured that that was indeed the solution. You can just declare the path as a Mixed
type by either declaring it as on of the following:
Schema.Types.Mixed
Object
Mongoose.Mixed
{}