This issue was found by executing the following command.
atlas generate model another --fields name=string,friends=string[]
All comments will refer to code artifacts generated by the previous command.
Foreword
This issue implies an architecture choice that would force other changes on the current express service. Currently, the controllers layer is coupled with a MongoDb database, for the simple reason that you are exposing the Mongo Document interface when returning the "INew & Document" (aliased as "INewModel") type.
The following comments will adress an issue that arises if the Document interface is not exposed to the controllers layer.
Example
For the following command
atlas generate model another --fields name=string,friends=string[]
Problem
Ex:
This issue was found by executing the following command.
atlas generate model another --fields name=string,friends=string[]
All comments will refer to code artifacts generated by the previous command.
Foreword
This issue implies an architecture choice that would force other changes on the current express service. Currently, the controllers layer is coupled with a MongoDb database, for the simple reason that you are exposing the Mongo Document interface when returning the "INew & Document" (aliased as "INewModel") type.
The following comments will adress an issue that arises if the Document interface is not exposed to the controllers layer.
Example
For the following command
atlas generate model another --fields name=string,friends=string[]
Sample output
See the database/interactions/new.ts file.
See the interfaces/INew.ts
The controller has no way of knowing a given database resource's id.
Proposal
Generated code for the interfaces/INew.ts
Generated Code for the database/interactions/new.ts