nexus-backend 1.0.9 → 1.1.0
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.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -10360,15 +10360,16 @@ var requiredEnv = (value, key) => {
|
|
|
10360
10360
|
// src/config/mongoConfig.ts
|
|
10361
10361
|
var import_mongoose = __toESM(require("mongoose"));
|
|
10362
10362
|
var connectMongoDb = async (config) => {
|
|
10363
|
-
const { subDomain, userName, password, cluster, dbName } = config;
|
|
10364
|
-
const
|
|
10363
|
+
const { subDomain, userName, password, cluster, dbName, shards, replicaSet } = config;
|
|
10364
|
+
const hosts = shards.map((s) => `${s}.${subDomain}.mongodb.net:27017`).join(",");
|
|
10365
|
+
const uri = `mongodb://${userName}:${password}@${hosts}/${dbName}?ssl=true&replicaSet=${replicaSet}&authSource=admin&appName=${cluster}`;
|
|
10365
10366
|
try {
|
|
10366
|
-
console.log("
|
|
10367
|
-
await import_mongoose.default.connect(
|
|
10367
|
+
console.log("Connecting to MongoDB...");
|
|
10368
|
+
await import_mongoose.default.connect(uri);
|
|
10368
10369
|
console.log("Connected to MongoDB Atlas");
|
|
10369
10370
|
return true;
|
|
10370
10371
|
} catch (err) {
|
|
10371
|
-
console.error("
|
|
10372
|
+
console.error("Connection failed:", err.message);
|
|
10372
10373
|
return false;
|
|
10373
10374
|
}
|
|
10374
10375
|
};
|