nestjs/mongoose

forFeatureAsync Move collection option from AsyncModelFactory into the useFactory return value

Closed this issue · 1 comments

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe it

Collection name is currently a static property and it can be turned into a dynamic one using proper dependency injection.

Describe the solution you'd like

Instead of having a collection under the AsyncModelFactory interface the collection property would be taken from the ModelDefinition type.

This is a breaking change because it will change the AsyncModelFactory interface. It can be solved by supporting both options with priority for one of them.

Teachability, documentation, adoption, migration strategy

No response

What is the motivation / use case for changing the behavior?

I have a collection that might have name "x" on one deployment and name "y" on another.

Thanks for your suggestion!

There are no plans to implement it in the foreseeable future.

If you think your request could live outside Nest's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.