-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
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
MongooseModule: same schema multiple collections #4
Comments
I was looking in the code, and found the provide is a JSON.stringify of Schema model, for that is you use the same schema even with differents names this problem appear. I go change the code and make a PR soon with "fix" |
@kamilmysliwiec, Can you check this? |
Is there an update on this? |
Only @kamilmysliwiec can do merge, so need wait. Meanwhile I compile with tsc the PR and replace the @nest/mongoose folder to use because in my project I need it. |
Hey, will try to verify this today. |
I'm submitting a...
Current behavior
In Mongo for the same schema
TypeSchema
name: string
_id: ObjectID
is used by multiple collections:
CategoriesCollection
TypesCollection
When you use the mongooseModule, you can define well this collections, but when you inject them on service with @InjectModel(TypeSchema), only one Model is reference.
This is because you inject it with schema as parameters, injectModel as name collections will be better to avoid this.
Expected behavior
Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
Use the same schema for multiple collections.
Environment
The text was updated successfully, but these errors were encountered: