MissingSchemaError:尚未为模型\“ [对象对象] \”注册模式。\ n请使用mongoose.model(name,schema)

我有这样的架构:

alignof(std::max_align_t)

它自己引用。 (不同文档的ID)。因此,我尝试以此填充他们:

const PuestoSchema = new Schema(
  {
   //....more data
   reportaA: {
      type: Schema.Types.ObjectId,ref: "Puesto"
    },//...
})


module.exports = mongoose.model("Puesto",PuestoSchema)

但是我有这个错误:

  

MissingSchemaError:尚未为模型\“ [对象注册模式   对象] \“。\ n请使用mongoose.model(name,schema)

q247877488 回答:MissingSchemaError:尚未为模型\“ [对象对象] \”注册模式。\ n请使用mongoose.model(name,schema)

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3101383.html

大家都在问