Typescript 我需要帮助引用nestJs中@Schema属性中声明的id
我有一个使用@schema定义_id和时间戳的模式,如下所示:Typescript 我需要帮助引用nestJs中@Schema属性中声明的id,typescript,mongoose,nestjs,typescript-typings,Typescript,Mongoose,Nestjs,Typescript Typings,我有一个使用@schema定义_id和时间戳的模式,如下所示: @Schema({ id: true, timestamps: { createdAt: 'createdAt', updatedAt: 'updatedAt', }, }) export class Account { @Prop({ type: String, enum: Roles, required: true, }) role?: string; @Prop({ type
@Schema({
id: true,
timestamps: {
createdAt: 'createdAt',
updatedAt: 'updatedAt',
},
})
export class Account {
@Prop({
type: String,
enum: Roles,
required: true,
})
role?: string;
@Prop({
type: String,
required: false,
})
businessName?: string;
}
我想在函数中引用帐户id,但由于它没有明确定义,所以我一直坚持使用它
await this.userService.updateAccount(
{ _id: filter._id },
{ outlet: findInvite.outlet._id }, //Property '_id' does not exist on type 'Outlet'.ts(2339)
'_id',
);
return;
}