Encountering this issue:
Error: Competition validation failed: results.0: Cast to ObjectId failed for value "{ name: 'David'}"
The main model is as follows:
class Competition {
@prop()
compName: string
@prop({ ref: () => CompetitionParticipant})
results: Ref<CompetitionParticipant>[]
}
And the sub-model looks like this:
class CompetitionParticipant {
@prop()
name: string
}
This is how it's being utilized:
const CompetitionResults = getModelForClass(Competition)
await new CompetitionResults({compName: 'competition name', results: [{name: 'David'}]}).save()