Replies: 1 comment
-
const transactionSchema = new mongoose.Schema({
buyer: {
type: mongoose.Schema.ObjectId,
ref: doc => doc.buyer
},
buyer: {
type: String,
enum: ['VIPClient', 'NormalClient']
}
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have the following schema:
and I have two models:
I want the VIPClient and the NormalClient to be referenced in the buyer ref path of the transactionSchema.
How?
Is there something in mongoose such as:
??
Is there a method to make it automatically understand which model was used to create its doc?
Beta Was this translation helpful? Give feedback.
All reactions