goosetyped.addconnection
Home > @pebula/goosetyped > addConnection
addConnection() function
Registers a connection with GooseTyped to be used to compile Models registered under the same connection Id.
Signature:
export declare function addConnection(connectionId: string, connectionFactory: () => (mongoose.Connection | Promise<mongoose.Connection>), connectOptions?: GtConnectOptions): Promise<unknown>;
Parameters
Parameter | Type | Description |
---|---|---|
connectionId | string | A unique id for this connection, will be used to find models with matching connectionId's. |
connectionFactory | () => (mongoose.Connection | Promise<mongoose.Connection>) | A function that returns a mongoose connection or a Promise for a mongoose connection. The connection does not have to be alive. |
connectOptions | (Optional) |
Returns:
Promise<unknown>