这是我用来连接数据库的代码:
private connectDatabase(databaseUri: string): Promise<Mongoose.Connection> {
return Mongoose.connect(databaseUri).then(() => {
debug('Connected to MongoDB at %O', databaseUri);
return Mongoose.connection;
});
}
今天我将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()`
我找不到有关如何"设置useMongoClient"的任何信息.
你们知道怎么做吗?