-
Currently I have: export class Category {
// ..............
@typegoose.prop({ _id: false })
public pizza?: Pizza
}
export class Pizza {
// ..............
@typegoose.prop({ type: PizzaSize, required: true, default: [] })
public sizes!: mongoose.Types.Array<PizzaSize>
}
export class PizzaPrice {
// ..............
@typegoose.prop({ required: true, ref: () => PizzaSize })
public size!: typegoose.Ref<PizzaSize>
}
|
Beta Was this translation helpful? Give feedback.
Answered by
hasezoey
Feb 8, 2024
Replies: 1 comment 1 reply
-
to my knowledge it is not possible to reference sub-documents, you will likely need to out-source the things you want to reference to their own collections, or reference the parents model |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
vitorhm
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
to my knowledge it is not possible to reference sub-documents, you will likely need to out-source the things you want to reference to their own collections, or reference the parents model