Example (by the @sugoi/mongodb package implementation):
First Step - Set connection item
Connection item is the class which contains all of the communication establishing/closing logic. Another role of this class is to reflect the connection current status. This class must implement the IConnection interface!
Setting a connection done by the ConnectableModel setConnection static function: public static setConnection(configData: IConnectionConfig, connectionClass:, connectionName: string = "default"): Promise<IConnectionConfig>
This method will create a connection item and store it for later use. Also, the connect method will get called.