mongoose 我遇到的错误是无法读取未定义(阅读'tree')的属性类型错误:无法读取未定义的属性(阅读“tree”)

huwehgph  于 2023-03-12  发布在  Go
关注(0)|答案(1)|浏览(188)

我的架构文件在这里

import * as mongoose from "mongoose";

export const memberAddressSchema = new mongoose.Schema({
  mumber_id: { type: String, required: true },
  city_id: { type: String, required: true },
  state_id: { type: String, required: true },
  pincode: { type: String, required: true },
  address: { type: String, required: true },
});

无法读取未定义(阅读“tree”)的属性类型错误:无法读取未定义的属性(阅读“tree”)

@Module({
    imports:[MongooseModule.forFeature([{name:'Admin', schema:adminSchema},{name:'Member',schema:memberAddressSchema}])],
    providers:[AdminService,MemberAddressService],
    
    exports:[AdminService,MemberAddressService]
})
export class AdminModule{}```
ckocjqey

ckocjqey1#

当我错误地将schema添加到@Moduleimports数组时,我得到了这个错误。我删除了它,它修复了这个问题。

相关问题