crazy-odds-bet-shared 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/db/mongodb.js +4 -2
- package/package.json +1 -1
package/db/mongodb.js
CHANGED
|
@@ -41,12 +41,14 @@ class MongoDB {
|
|
|
41
41
|
) {
|
|
42
42
|
try {
|
|
43
43
|
const uri = connectionString || process.env.MONGODB_URI;
|
|
44
|
-
const database = dbName || process.env.
|
|
44
|
+
const database = dbName || process.env.MONGODB_DATABASE;
|
|
45
45
|
|
|
46
46
|
if (!uri) {
|
|
47
47
|
throw new Error('MongoDB URI not provided. Set MONGODB_URI in .env or pass as parameter.');
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
logger.info(`Connecting to MongoDB at ${uri}${database ? ` (database: ${database})` : ''}...`);
|
|
51
|
+
|
|
50
52
|
// Construct full connection string with database name
|
|
51
53
|
let fullUri = uri;
|
|
52
54
|
if (database) {
|
|
@@ -59,7 +61,7 @@ class MongoDB {
|
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
this.connection = await mongoose.connect(fullUri, options);
|
|
62
|
-
logger.info(`✓ Connected to MongoDB${database ? ` (database: ${database})` : ''}`);
|
|
64
|
+
logger.info(`✓ Connected to MongoDB ${uri}${database ? ` (database: ${database})` : ''}`);
|
|
63
65
|
} catch (error) {
|
|
64
66
|
logger.error('✗ Failed to connect to MongoDB:', error);
|
|
65
67
|
throw error;
|