You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(db-mongodb): add afterCreateConnection and afterOpenConnection hooks (#14649)
This PR exposes `afterCreateConnection` and `afterOpenConnection` hooks
through the db-mongodb adapter args.
## Use-case
These lifecycle hooks allow developers to perform additional setup logic
after a MongoDB connection or pool has been created or opened - for
example, to enable [connection pooling in Vercel
Functions](https://vercel.com/guides/connection-pooling-with-functions):
```ts
export const databaseAdapter = mongooseAdapter({
// ...
afterCreateConnection: async (adapter) => {
const client = adapter.connection.getClient()
attachDatabasePool(client);
},
})
```
0 commit comments