fix mongoose connection

This commit is contained in:
SowinskiBraeden committed 2023-04-09 22:01:11 -07:00
1 parent f1853dd3bb
commit daf6b56e4c
2 files changed
+7 -2

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "quarksbot", "name": "quarksbot",
"version": "13.2.7", "version": "13.2.8",
"description": "Grand Theft Auto V Roleplay Bot", "description": "Grand Theft Auto V Roleplay Bot",
"main": "index.js", "main": "index.js",
"nodemonConfig": { "nodemonConfig": {
+6 -1
View File
@@ -97,7 +97,12 @@ class QuarksBot extends Client {
// Connect to Mongo database. // Connect to Mongo database.
this.db = await MongoClient.connect(mongoURI, {connectTimeoutMS: 1000}); this.db = await MongoClient.connect(mongoURI, {connectTimeoutMS: 1000});
this.dbo = this.db.db(dbo); this.dbo = this.db.db(dbo);
mongoose.connect(`${mongoURI}/${dbo}`); mongoose.connect(`mongodb://${mongoURI.split('@')[1]}/${dbo}`, {
authSource: "admin",
user: mongoURI.split('//')[1].split(':')[0],
pass: mongoURI.split('//')[1].split(':')[1].split('@')[0],
useNewUrlParser: true,
}).catch(e=>this.error(e));
this.log('Successfully connected to mongoDB'); this.log('Successfully connected to mongoDB');
databaselogs.connected = true; databaselogs.connected = true;
databaselogs.attempts = 0; // reset attempts databaselogs.attempts = 0; // reset attempts