Let's say I want to build the below schema with mongoose:
const userSchema = new Schema({
name: {
firstName: String,
lastName: String
}
})
How can I do it with NestJS decorators (@Schema() & @Prop())?
I try this method, but no luck:
@Schema()
class Name {
@Prop()
firstName: string;
@Prop()
lastName: string;
}
@Schema()
class User extends Document {
@Prop({ type: Name })
name: Name;
}
I also don't want to use the raw() method.