src/mongoose.js
function createService (app, Service, Model, options) {
  Model = options.Model || Model;
  if (typeof Model === 'function') {
    assert(options.ModelName, 'createService but options.ModelName not provided');
    options.Model = Model(app, options.ModelName);
  } else {
    options.Model = Model;
  }
  const service = new Service(options);
  return service;
}
function createService (app, Service, Model, options) {
  Model = options.Model || Model;
  if (typeof Model === 'function') {
    assert(options.ModelName, 'createService but options.ModelName not provided');
    options.Model = Model(app, options.ModelName);
  } else {
    options.Model = Model;
  }
  const service = new Service(options);
  return service;
}
function createService ( app , Service , Model , options ) { Model = options . Model || Model ; if ( typeof Model === 'function' ) { assert ( options . ModelName , 'createService but options.ModelName not provided' ) ; options . Model = Model ( app , options . ModelName ) ; } else { options . Model = Model ; } const service = new Service ( options ) ; return service ; }
Create a service with mogoose model
Create a service with mogoose model