importMongofrom'@tadashi/mongo-singleton'constclient=awaitMongo.conn({url: 'mongodb://mongodb.example.com:27017',username: 'username',password: 'password'})constdb=client.db('my_DB')awaitdb.dropDatabase()// more code...
Example B:
// Set the environment variables before start the application// - MONGO_CONN// - MONGO_DB// - MONGO_USER// - ...importMongofrom'@tadashi/mongo-singleton'// will return the collection if exists or create new oneconstcollection=awaitMongo.collection('users')constusers=awaitcollection.find({name: 'Tadashi'}).toArray()// more code...