express+mongoose写接口的时候,第二次请求报错

mac2026-01-03  8

出现如下报错:

(node:3488) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): OverwriteModelEr ror: Cannot overwrite col_1 model once compiled.

解决办法是将 mongoose.model 模型定义在请求接口外面,不能重复定义!

最新回复(0)