Open esimonm opened 2 years ago
Hi @esimonm thanks for the feedback. Regarding you query on discriminators
i don't think the library does a hard type check against this. However this check can come from the underlying dependency types of mongoose that are being used is what my guess is. If you think otherwise can you point me to the line in the code where this is happening with a sample code so that i can debug it further.
Thanks for the quick reply @sandeepsuvit, really appreciate it. Please see the following error I'm getting when declaring the discriminators on the module's TenancyModule.forFeature
as shown in Nest's documentation.
And here is the ModelDefinition
interface:
Let me know if you need any more info, thanks!
Hi @esimonm thanks for pointing it out. I haven't used discriminators
with nestjs before so i am not familiar with its functionality. I have made the changes referring to nestjs/mongoose wrapper implementation. The changes are available under the following branch. Please check it out and let me know if its working for you. If it does, then ill release a new version with these changes.
Thanks for the quick update! Tried it and there are no longer any type errors, but unfortunately, it's still giving an error when compiling as shown here:
"Issue" is the Entity the module is based on. Two other entities are used in the discriminator array. Seems like the Tenancy module is not importing the Issue module?
Please let me know if there's any more info needed. Thanks again.
@esimonm can you provide me a minimal example working sample repo to test this out.
Hi @sandeepsuvit, I hope you are doing well. First, thanks for developing this, I've found it super helpful and so easy to apply!
I wonder if it'd be possible for us to apply discriminators the same way as Nest currently does (please see the application in https://docs.nestjs.com/techniques/mongodb#discriminators). Currently, there is no way to declare the discriminators in the module's imports, as it throws a type error as the
discriminators
field is not declared in theModelDefinition
interface you created.This would be a great addition to our current projects.
Again, thanks for all your effort, looking forward to your reply!