This guide will take you step by step on how to create and use databases using CLI
1. Run the following command in the terminal:
$ mdb database init
2. Choose mongodb
3. You will be asked to create new user. Hit Enter to accept.
4. Provide username
, password
, database name
and description.
CLI will display your username, password, database name and connections string.
Note: Your final username and database name may differ from your inputs. MDB GO may add some characters to randomize username and database name.
5. Your database is ready to use.
async function main(){
/**
* Connection URI. Update <username>, <password>, and <your-cluster-url> to reflect your cluster.
* See https://docs.mongodb.com/ecosystem/drivers/node/ for more details
*/
const uri = "mongodb://username:password@mongo.db.mdbgo.com:port/database_name";
const client = new MongoClient(uri);
try {
// Connect to the MongoDB cluster
await client.connect();
// Make the appropriate DB calls
await listDatabases(client);
} catch (e) {
console.error(e);
} finally {
await client.close();
}
}
main().catch(console.error);
If you forget password to your database you can easily set a new one.
1. Navigate to: Databases panel
2. Find database which you want to update and click Edit
button next to it
3. Provide a new password (and re-type new password), then submit.
If you forget password to your database you can easily set a new one.
1. Open terminal and type the following command:
$ mdb database config password
2. Choose a database from the list
3. Provide a new password (and re-type new password), then submit.