"use strict";

function _getDb() {
    return new Promise((resolve, reject) => {
        let factory = require('mongo-factory');
        factory.getConnection(process.env.DB_CONNECTIONSTRING)
            .then(dbInstance => {
                resolve(dbInstance);
            })
            .catch(e => {
                reject(e);
            });
    });
}

module.exports = {
    getDb: _getDb,

    getManager: function (ManagerType) {
        return _getDb()
            .then(db => {
                return Promise.resolve(new ManagerType(db, {
                    username: "dev"
                }));
            })
    }
}
@@ -215,24 +215,182 @@
 stance =%3E %7B%0A
+                dbInstance.use = dbInstance.use %7C%7C((collectionName) =%3E %7B%0A                    return dbInstance.collection(collectionName)%0A                %7D);%0A
             

update helper