module.exports = async function (mongoose) {
    try {
        console.log('🔌 Attempting to connect with URI:', process.env.CONNECTION_URI);
        await mongoose.connect(process.env.CONNECTION_URI, {
            useNewUrlParser: true,
            useUnifiedTopology: true,
            directConnection: true,
        });
        console.log('✅ MongoDB connected');
    } catch (err) {
        console.error('❌ MongoDB connection error:', err);
        process.exit(1);
    }
};
