Closed jbool24 closed 7 months ago
@jbool24 thanks for this! this is such a good idea. but do you think we can have it in the defineMongooseModel
as an optinal param? like:
return baseModel ? baseModel!.discriminator<T>(name, newSchema) : mongoose.model<T>(name, newSchema)
@arashsheyda I don't have a good reason why not. But I was just trying to keep things separated instead of using internal flags to manipulate what the factory outputs. Your lib, your choice :smiley: :+1:
@jbool24 sorry for late reply, I think becuase they share a lot of similarities it's better to do it that way.
ps. it's an open source lib so we can talk about it :) it's not my choice only
@arashsheyda In that case :smile:, my two-cents is keeping the two factories discrete from each other because...
I'm open to hear why combining them would be good also.
@jbool24 well here are my thoughts for having it as Combined Factory Function
:
but as you said having it as Separate Factory Functions
has it own pros too!
🤔
As a regular (not so specialized) Mongoose user, I prefer the ideas for a Separate Factory Functions
. I just want a new function that allow me to create a Discriminator, otherwise, I aggree that it is kind of confusing.
@jbool24 thank you!
Allow extension and inheritance of base models with discriminator models.