mongo Client.connect ('mongodb://localhost/cursoNode', {useNewUrlParser: true,useUnifiedTopology: true }); .then( conn() => {global.conn = conn.db("cursoNode") }).catch ((error) => { console.log ("error") }) code example

Example: mongo Client.connect ('mongodb://localhost/cursoNode', {useNewUrlParser: true,useUnifiedTopology: true }); .then( conn() => {global.conn = conn.db("cursoNode") }).catch ((error) => { console.log ("error") })

mongoClient.connect ('mongodb://localhost/cursoNode', {useNewUrlParser: true,useUnifiedTopology: true });

.then( conn() => {global.conn = conn.db("cursoNode") }).catch ((error) => {
         console.log ("error")
})

Tags:

Misc Example