Skip to content

Build order for Classes to Schemas is changed to bottom-up #629

Answered by hasezoey
j-d-carmichael asked this question in Q&A
Discussion options

You must be logged in to vote

i hope the following example explains what is affected:

on 8.3.0:

// NodeJS: 16.11.0
// MongoDB: 4.2-bionic (Docker)
import { getModelForClass, prop } from '@typegoose/typegoose'; // @typegoose/typegoose@8.3.0
import { assertion } from '@typegoose/typegoose/lib/internal/utils';
import * as mongoose from 'mongoose'; // mongoose@5.13.13

class Animal {
  @prop({ default: 'AnimalType' })
  public type?: string;

  public getName(): string {
    return 'AnimalGetName';
  }
}

class Cat extends Animal {
  @prop({ default: 'CatType' })
  public type?: string;

  @prop({ default: 'unknownSubType' })
  public subtype?: string;

  public getName(): string {
    return 'CatGetName';
  }
}

class Ma…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by j-d-carmichael
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants