Skip to content

Conversation

@naxel
Copy link

@naxel naxel commented Oct 23, 2020

Fixed #3
Fixed connection to MongoDB

const mongoConn = new MongoConnection(await prompts(mongoPrompts));
await mongoConn.connect().catch(e => process.exit());
// @ts-ignore
const mysqlConn = new Database(mysqlConfig(await prompts(mysqlPrompts)));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MySQL connection needs to be established first

return new RegExp(/^(?:(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])(\.(?!$)|$)){4}$/).test(options.mongohost)
? `mongodb://${options.mongousername.trim()}:${options.mongopassword.trim()}@${options.mongohost.trim()}/${options.mongodatabase.trim()}?retryWrites=true`
: `mongodb+srv://${options.mongousername.trim()}:${options.mongopassword.trim()}@${options.mongohost.trim()}/${options.mongodatabase.trim()}?retryWrites=true`;
? `mongodb://${options.mongousername.trim()}:${options.mongopassword.trim()}@${options.mongohost.trim()}/${options.mongodatabase.trim()}?authSource=admin&readPreference=primary&retryWrites=true&w=majority&ssl=false`
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auth source is not always admin, some users authenticate to different databases depending on type of user

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No progress after connecting to Mysql.

2 participants