We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there a way to implement a refPath for the Type.ref() pattern?
Type.ref()
I'm talking about this https://mongoosejs.com/docs/populate.html#dynamic-ref
The text was updated successfully, but these errors were encountered:
@hennessyevan do you found a solution for this?
Sorry, something went wrong.
I gave up on using these sorts of libs and just went for straight mongoose with types 🤷🏻♂️
You can just declare your field with the regular mongoose syntax, inside your ts-mongoose schema:
For example:
const MyModelSchema = createSchema( { type: Type.string({ required: true, index: true, enum: Object.values(ItemType) }), items: { type: Schema.Types.ObjectId, refPath: "type" }, } ) const MyModel = typedModel("MyModel", MyModelSchema) // ... await MyModel.find().populate("items)
No branches or pull requests
Is there a way to implement a refPath for the
Type.ref()
pattern?I'm talking about this https://mongoosejs.com/docs/populate.html#dynamic-ref
The text was updated successfully, but these errors were encountered: