module.exports = function repository(db) {
  return {
    save: (collection, data, response) => {
      db[collection].insertOne(data, response);
    },
    update: (collection, query, update, opts = {}, response) => {
      db[collection].update(query, update, opts, response);
    },
    find: (collection, query, projection = {}, response) => {
      db[collection].find(query, projection, response);
    },
    findOne: (collection, query, projection = {}, response) => {
      db[collection].findOne(query, projection, response);
    }
  };
};

module.exports = function repository(db) {
  return {
    save: (collection, data, response) => {
      db[collection].insertOne(data, response);
    },
    update: (collection, query, update, response, opts = {}) => {
      db[collection].update(query, { $set: update }, opts, response);
    },
    find: (collection, query, response, projection = {}) => {
      db[collection].find(query, projection, response);
    },
    findOne: (collection, query, response, projection = {}) => {
      db[collection].findOne(query, projection, response);
    }
  };
};

Update opts and projection params.
Update opts and projection params.

Default opts to empty object
Default projection to empty object
Wrap update in $set
