今天遇到mongoose有两个报错,导致npm在docker中一直无法正常启动
第一个报错:
[egg-scripts] Got error when startup:
[egg-scripts] (node:64) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
在options中添加
useUnifiedTopology: true,
第二个报错:
[egg-scripts] (node:48) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.
在options中添加
useCreateIndex: true
下图红圈部分就是添加的部分: