这是我用来连接数据库的代码:
private connectDatabase(databaseUri: string): Promise<Mongoose.Connection> {
return Mongoose.connect(databaseUri).then(() => {
debug('Connected to MongoDB at %O', databaseUri);
return Mongoose.connection;
});
}
Run Code Online (Sandbox Code Playgroud)
今天我将Mongoose更新到4.11.0版本,运行我的测试时收到了这个警告:
(node:4138) DeprecationWarning: `open()` is deprecated in mongoose >= 4.11.0,
use `openUri()` instead, or set the `useMongoClient` option if using `connect()`
or `createConnection()`
Run Code Online (Sandbox Code Playgroud)
我找不到任何关于如何"设置useMongoClient"的信息.
你们知道怎么样吗?