upgraded mongodb driver

This commit is contained in:
Jan Prochazka
2024-02-12 12:55:20 +01:00
parent f090661eb9
commit 504bbeac52
3 changed files with 72 additions and 59 deletions

View File

@@ -10,9 +10,24 @@ class Analyser extends DatabaseAnalyser {
const collections = collectionsAndViews.filter((x) => x.type == 'collection');
const views = collectionsAndViews.filter((x) => x.type == 'view');
const stats = await Promise.all(
collections.filter((x) => x.type == 'collection').map((x) => this.pool.__getDatabase().collection(x.name).stats())
);
let stats;
try {
stats = await Promise.all(
collections
.filter((x) => x.type == 'collection')
.map((x) =>
this.pool
.__getDatabase()
.collection(x.name)
.aggregate([{ $collStats: { count: {} } }])
.toArray()
.then((resp) => ({ name: x.name, count: resp[0].count }))
)
);
} catch (e) {
// $collStats not supported
stats = {};
}
const res = this.mergeAnalyseResult({
collections: [