-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Closed
Labels
Description
Issue type:
[ ] question
[x] bug report
[ ] feature request
[ ] documentation issue
Database system/driver:
[ ] cordova
[x] mongodb
[ ] mssql
[ ] mysql / mariadb
[ ] oracle
[ ] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo
TypeORM version:
[x] latest
[ ] @next
[ ] 0.x.x (or put your version here)
Steps to reproduce or a small repository showing the problem:
MongoQueryRunner.databaseConnection has the type Db while it should actually be MongoClient.
Where databaseConnection is defined in src/driver/mongodb/MongoQueryRunner.ts:
/**
* Real database connection from a connection pool used to perform queries.
*/
databaseConnection: Db;
// -------------------------------------------------------------------------
// Constructor
// -------------------------------------------------------------------------
constructor(connection: Connection, databaseConnection: Db) {
this.connection = connection;
this.databaseConnection = databaseConnection;
this.broadcaster = new Broadcaster(this);
}Where it is created in src/driver/mongodb/MongoDriver.ts:
connect(): Promise<void> {
return new Promise<void>((ok, fail) => {
this.mongodb.MongoClient.connect(
this.buildConnectionUrl(),
this.buildConnectionOptions(),
(err: any, client: any) => {
if (err) return fail(err);
this.queryRunner = new MongoQueryRunner(this.connection, client);
ObjectUtils.assign(this.queryRunner, { manager: this.connection.manager });
ok();
});
});
}Reference to mongodb.MongoClient.connect:
https://mongodb.github.io/node-mongodb-native/3.1/api/MongoClient.html#~connectCallback