.NET hook with MongoDB

In the model-service-controller-database model of develop a web app with C# and MongoDB, can I connect one model to multiple collections?

Like I am managing tools from two persons, one web page shows the tools from me, another one shows the tools from my friend. The properties of the tools are the same. Can I use one model to link to the two pages or I have to build two models, two services, and two controllers for this small web app?

Thanks for your opinion

Hi @Ningran_Meng ,

Sounds like a single model can cover this. Since MongoDB allow Flexible schemas every user can have ita own set documents and the model can query each users data by the user identifier.

So each user can load its document and map it to the same model just parametriszed.


Thanks for your response. I can try. If I use the architecture of the M220N course, the mflix one. How that is going to work, do I need to write multiple repos and controllers for the single model class?

Thank you.