message: Added function setModelForClass to allow models to be overwritten
diff: @@ -23,7 +23,14 @@ export class Typegoose {
  getModelForClass<T>(t: T, { existingMongoose, schemaOptions, existingConnection }: GetModelForClassOptions = {}) {
  const name = this.constructor.name;
  if (!models[name]) {
  - const Schema = mongoose.Schema;
  + this.setModelForClass(t, { existingMongoose, schemaOptions, existingConnection });
  + }
  +
  + return models[name] as ModelType<this> & T;
  + }
  +
  + setModelForClass<T>(t: T, { existingMongoose, schemaOptions, existingConnection }: GetModelForClassOptions = {}) {
  + const name = this.constructor.name;
  // get schema of current model
  let sch = this.buildSchema(name, schemaOptions);
  @@ -46,7 +53,6 @@ export class Typegoose {
  models[name] = model(name, sch);
  constructors[name] = this.constructor;
  - }
  return models[name] as ModelType<this> & T;
  }
  