mongoose.connect('mongodb://localhost/test');
(node:4964) 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});
问题解决。
本文解决了使用Mongoose连接MongoDB时出现的警告信息,通过设置`useMongoClient`选项为`true`,避免了使用已废弃的`open()`方法。

3547

被折叠的 条评论
为什么被折叠?



