node 项目启动警告 (node:13680) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes
描述
使用该模板项目启动警告:DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.
原因
mongoose模块api废弃了collection.ensureIndex报的错
解决
// 链接数据库 mongoose.set('useCreateIndex', true) 也可以直接写道option里边
// 加上这个 mongoose.connect(db, { u...
原创
2020-05-29 10:26:54 ·
2964 阅读 ·
1 评论