const mongodb = require('mongodb');
require('dotenv').config({ path: require('path').join(__dirname, '.env') });

// Try without replicaSet
const uri = 'mongodb://admin:adminpassword@192.168.0.197:27017/ludo?authSource=admin';
console.log('Testing without replicaSet:', uri);

mongodb.MongoClient.connect(uri, {
    useNewUrlParser: true,
    useUnifiedTopology: true,
    authSource: 'admin',
    serverSelectionTimeoutMS: 5000,
}, (err, client) => {
    if (err) {
        console.error('❌ Connection error:', err.message);
        process.exit(1);
    } else {
        console.log('✅ Connected successfully!');
        client.close();
        process.exit(0);
    }
});
