Skip to content

Commit

Permalink
add collection name to connect log
Browse files Browse the repository at this point in the history
  • Loading branch information
lnart committed Apr 19, 2024
1 parent 21ce652 commit 39296ac
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/db/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ export async function connectToDb() {
if (process.env.CLOUD_DB_CONNECTION_STRING) {
const db = await mongoose
.connect(`${process.env.CLOUD_DB_CONNECTION_STRING}`)
.then(() => console.log(`Successfully connected to MongoDB`))
.then((db) =>
console.log(
`Successfully connected to MongoDB: `,
db.connections[0].name,
),
)
.catch((error) => console.error(`Connection error: ${error}`));
return db;
}
Expand Down

0 comments on commit 39296ac

Please sign in to comment.