nexus-backend 1.0.8 → 1.0.9
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/dist/index.js +4 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10362,23 +10362,14 @@ var import_mongoose = __toESM(require("mongoose"));
|
|
|
10362
10362
|
var connectMongoDb = async (config) => {
|
|
10363
10363
|
const { subDomain, userName, password, cluster, dbName } = config;
|
|
10364
10364
|
const srvURL = `mongodb+srv://${userName}:${password}@${cluster.toLowerCase()}.${subDomain}.mongodb.net/${dbName}?retryWrites=true&w=majority&appName=${cluster.toLowerCase()}`;
|
|
10365
|
-
const fallbackURL = `mongodb://${userName}:${password}@ac-hkntio7-shard-00-00.${subDomain}.mongodb.net:27017,ac-hkntio7-shard-00-01.${subDomain}.mongodb.net:27017,ac-hkntio7-shard-00-02.${subDomain}.mongodb.net:27017/${dbName}?ssl=true&replicaSet=atlas-cji6jk-shard-0&authSource=admin&appName=${cluster}`;
|
|
10366
10365
|
try {
|
|
10367
|
-
console.log("Trying
|
|
10366
|
+
console.log("Trying +srv connection...");
|
|
10368
10367
|
await import_mongoose.default.connect(srvURL);
|
|
10369
|
-
console.log("Connected to MongoDB Atlas
|
|
10368
|
+
console.log("Connected to MongoDB Atlas");
|
|
10370
10369
|
return true;
|
|
10371
10370
|
} catch (err) {
|
|
10372
|
-
console.
|
|
10373
|
-
|
|
10374
|
-
try {
|
|
10375
|
-
await import_mongoose.default.connect(fallbackURL);
|
|
10376
|
-
console.log("Connected to MongoDB Atlas via fallback URL");
|
|
10377
|
-
return true;
|
|
10378
|
-
} catch (fallbackErr) {
|
|
10379
|
-
console.error("Fallback connection failed:", fallbackErr.message);
|
|
10380
|
-
return false;
|
|
10381
|
-
}
|
|
10371
|
+
console.error("+srv connection failed:", err.message);
|
|
10372
|
+
return false;
|
|
10382
10373
|
}
|
|
10383
10374
|
};
|
|
10384
10375
|
|