DEV Community

Dimitrios Desyllas
Dimitrios Desyllas

Posted on

Will nodejs' mongodb client will create a new db for me?

According to tie piece of documentation if I run these upon mongosh:

use myDB
db.myNewCollection1.insertOne( { x: 1 } )

Will automatically create a myDb database and will a collection myNewCollection1.

Therefore if upon my nodejs run:

const {MongoClient, ServerApiVersion} = require('mongodb')
// Connectionstring
const uri = 'mongodb://root:example@127.0.0.1:27017/';

//

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

Retry later