1const MongoClient = require( 'mongodb' ).MongoClient;
2const url = "mongodb://localhost:27017";
3
4var _db;
5
6module.exports = {
7
8 connectToServer: function( callback ) {
9 MongoClient.connect( url, { useNewUrlParser: true }, function( err, client ) {
10 _db = client.db('test_db');
11 return callback( err );
12 } );
13 },
14
15 getDb: function() {
16 return _db;
17 }
18};