express server connect to mongo code example

Example 1: express database

Some Databases : 

1.https://pouchdb.com/ - Light Weight - Alot of Functions
2.https://dbdb.io/db/nedb - Light Weight - Easy To Use 
3.https://www.mongodb.com/ - Best DB - Complex To Use

Example 2: how to access a database in express

var mysql = require('mysql')
var connection = mysql.createConnection({
  host: 'localhost',
  user: 'dbuser',
  password: 's3kreee7',
  database: 'my_db'
})

connection.connect()

connection.query('SELECT 1 + 1 AS solution', function (err, rows, fields) {
  if (err) throw err

  console.log('The solution is: ', rows[0].solution)
})

connection.end()