Nestjs MongoDb Schema/Interface Information Duplication Nestjs MongoDb Schema/Interface Information Duplication mongoose mongoose

Nestjs MongoDb Schema/Interface Information Duplication


You can check out the nest.js typegoose library. The library creates the schema definition from an annotated typescript class.

export class Cat extends Typegoose {  @prop({ required: true })  name: string;}

Alternatively you can use typeorm with mongodb, which only needs one annotated typescript interface as well.