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)