// Test database connection require('dotenv').config({ path: '.env.local' }); const mongoose = require('mongoose'); async function testDbConnection() { try { const mongoUri = process.env.MONGODB_URI || 'mongodb://localhost:27017/candidate_filter_portal'; console.log('Connecting to:', mongoUri); await mongoose.connect(mongoUri, { serverSelectionTimeoutMS: 5000 }); console.log('MongoDB connected successfully!'); // Close the connection await mongoose.disconnect(); console.log('MongoDB disconnected'); } catch (error) { console.error('MongoDB connection error:', error); } } testDbConnection();