Database version in features (#5627)
* adding database.version in the serverInfo (only MongoDB, it gives undefined when using Postgres) * . correction of old 'features' tests . adding engine and database in the StorageAdapter interface and implementations * . version retrieval done in performInitialization . PostgreSQL version * performInitialization now returns a Promise
This commit is contained in:
committed by
Diamond Lewis
parent
266d6328a3
commit
7fc0d45b89
@@ -126,6 +126,8 @@ export class MongoStorageAdapter implements StorageAdapter {
|
||||
client: MongoClient;
|
||||
_maxTimeMS: ?number;
|
||||
canSortOnJoinTables: boolean;
|
||||
databaseVersion: string;
|
||||
engine: string;
|
||||
|
||||
constructor({
|
||||
uri = defaults.DefaultMongoURI,
|
||||
@@ -136,6 +138,7 @@ export class MongoStorageAdapter implements StorageAdapter {
|
||||
this._collectionPrefix = collectionPrefix;
|
||||
this._mongoOptions = mongoOptions;
|
||||
this._mongoOptions.useNewUrlParser = true;
|
||||
this.engine = 'MongoDB';
|
||||
|
||||
// MaxTimeMS is not a global MongoDB client option, it is applied per operation.
|
||||
this._maxTimeMS = mongoOptions.maxTimeMS;
|
||||
@@ -959,7 +962,15 @@ export class MongoStorageAdapter implements StorageAdapter {
|
||||
}
|
||||
|
||||
performInitialization(): Promise<void> {
|
||||
return Promise.resolve();
|
||||
// databaseVersion
|
||||
return this.connect()
|
||||
.then(() => {
|
||||
const adminDb = this.database.admin();
|
||||
return adminDb.serverStatus();
|
||||
})
|
||||
.then(status => {
|
||||
this.databaseVersion = status.version;
|
||||
});
|
||||
}
|
||||
|
||||
createIndex(className: string, index: any) {
|
||||
|
||||
Reference in New Issue
Block a user