DeprecationWarning:'open()' is deprecated in mongoose>=4.11.0,use 'openUri()' instead or set the 'useMongoClient' option if using 'connect()' or 'createConnection'
阅读原文时间:2023年07月14日阅读:2

mongoose.connect('mongodb://localhost/test');
报错:
(node:2752) DeprecationWarning: `open()` is deprecated in mongoose >= 4.11.0, use `openUri()` instead,
or set the `useMongoClient` option if using `connect()` or `createConnection()`.
See http://mongoosejs.com/docs/connections.html#use-mongo-client
解决:
mongoose.connect('mongodb://localhost/test',{useMongoClient: true});

手机扫一扫

移动阅读更方便

阿里云服务器
腾讯云服务器
七牛云服务器

你可能感兴趣的文章