nexus-backend 1.0.7 → 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/README.md +349 -349
- 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 +35 -35
package/dist/index.mjs
CHANGED
|
@@ -10340,23 +10340,14 @@ import mongoose from "mongoose";
|
|
|
10340
10340
|
var connectMongoDb = async (config) => {
|
|
10341
10341
|
const { subDomain, userName, password, cluster, dbName } = config;
|
|
10342
10342
|
const srvURL = `mongodb+srv://${userName}:${password}@${cluster.toLowerCase()}.${subDomain}.mongodb.net/${dbName}?retryWrites=true&w=majority&appName=${cluster.toLowerCase()}`;
|
|
10343
|
-
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}`;
|
|
10344
10343
|
try {
|
|
10345
|
-
console.log("Trying
|
|
10344
|
+
console.log("Trying +srv connection...");
|
|
10346
10345
|
await mongoose.connect(srvURL);
|
|
10347
|
-
console.log("Connected to MongoDB Atlas
|
|
10346
|
+
console.log("Connected to MongoDB Atlas");
|
|
10348
10347
|
return true;
|
|
10349
10348
|
} catch (err) {
|
|
10350
|
-
console.
|
|
10351
|
-
|
|
10352
|
-
try {
|
|
10353
|
-
await mongoose.connect(fallbackURL);
|
|
10354
|
-
console.log("Connected to MongoDB Atlas via fallback URL");
|
|
10355
|
-
return true;
|
|
10356
|
-
} catch (fallbackErr) {
|
|
10357
|
-
console.error("Fallback connection failed:", fallbackErr.message);
|
|
10358
|
-
return false;
|
|
10359
|
-
}
|
|
10349
|
+
console.error("+srv connection failed:", err.message);
|
|
10350
|
+
return false;
|
|
10360
10351
|
}
|
|
10361
10352
|
};
|
|
10362
10353
|
|