Update MongoDB connection logging in db.js

- Enhanced connection log to specify 'MongoDB Atlas - Database: faber-finances'
- Added comment clarifying that the database is created automatically upon the first document insertion
This commit is contained in:
Jennie Robinson Faber 2025-08-23 12:22:17 +01:00
parent ad9224b761
commit 1f18ad001d

View file

@ -16,8 +16,9 @@ export async function connectToDatabase() {
try { try {
client = new MongoClient(uri) client = new MongoClient(uri)
await client.connect() await client.connect()
// MongoDB will create the database automatically when first document is inserted
db = client.db('faber-finances') db = client.db('faber-finances')
console.log('Connected to MongoDB') console.log('Connected to MongoDB Atlas - Database: faber-finances')
return db return db
} catch (error) { } catch (error) {
console.error('Failed to connect to MongoDB:', error) console.error('Failed to connect to MongoDB:', error)