MongoDB database connector on NodeJS
So I kind of figured this out. The db connector can be passed around like just another variable. Silly I didn't realise this before. I created a new file to abstract the model.

dbOperations.js

exports.addToDB = async function (model, dataObj, listName, res) {
  model.update({
      userid: dataObj.userID
    }, {
      $addToSet: {
        listName: {
          $each: dataObj.playerID
        }
      }
    }, {
      upsert: true
    },
    function (err, data) {
      if (!err &amp;&amp; data) {
        util.successResponder(res, successText);
      } else {
        util.serverErrorResponder(res, errorOccured);
      }
    });
};


teamController.js

var mongoose = require('mongoose');
const teamModel = mongoose.model('teamModel');
const dbOperations = require('../../helper/dbOperations');

exports.addPlayerToTeam = function (req, res) {
  let dataObj = {teamID: req.body.teamID, playerID: req.body.playerList};
  dbOperations.addToDB(teamModel,dataObj,'teamList',res);
}


And similarly for the other file as well. Any other files which follow a similar schema can use it. There is probably a better way to do this so that this can be generalised further to accommodate other schema types.