How to configure connection Adonis.Js using a cluster MongoDB Atlas
sotnaspina opened this issue · comments
I'am setting my connection in Adonis.js from MongoDB Atlas, but i don't know how complete this configuration.
I´m using https://github.com/duyluonglc/lucid-mongo
I have only the connection string currently:
mongodb+srv://username:<password>@cluster0-qawse.mongodb.net/test?retryWrites=true&w=majority
config/database.js
|--------------------------------------------------------------------------
| Default Connection
|--------------------------------------------------------------------------
|
| Connection defines the default connection settings to be used while
| interacting with Mongodb databases.
|
*/
connection: Env.get('DB_CONNECTION', 'mongodb'),
/*-------------------------------------------------------------------------*/
mongodb: {
client: 'mongodb',
connectionString: Env.get('DB_CONNECTION_STRING', 'mongodb+srv://username:<password>@cluster0-qawse.mongodb.net/test?retryWrites=true&w=majority'),
connection: {
host: Env.get('DB_HOST', 'localhost'),
port: Env.get('DB_PORT', 27017),
username: Env.get('DB_USER', 'admin'),
password: Env.get('DB_PASSWORD', ''),
database: Env.get('DB_DATABASE', 'adonis'),
options: {
// replicaSet: Env.get('DB_REPLICA_SET', '')
// ssl: Env.get('DB_SSL, '')
// connectTimeoutMS: Env.get('DB_CONNECT_TIMEOUT_MS', 15000),
// socketTimeoutMS: Env.get('DB_SOCKET_TIMEOUT_MS', 180000),
// w: Env.get('DB_W, 0),
// readPreference: Env.get('DB_READ_PREFERENCE', 'secondary'),
// authSource: Env.get('DB_AUTH_SOURCE', ''),
// authMechanism: Env.get('DB_AUTH_MECHANISM', ''),
// other options
}
}
},
I would like to know how I can complete the configuration or something alternative, thanks!!