mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 02:06:01 +00:00
upgraded mongodb driver
This commit is contained in:
@@ -37,7 +37,7 @@
|
||||
"webpack-cli": "^3.3.11",
|
||||
"dbgate-tools": "^5.0.0-alpha.1",
|
||||
"is-promise": "^4.0.0",
|
||||
"mongodb": "^4.7.0",
|
||||
"mongodb-client-encryption": "^2.1.0"
|
||||
"mongodb": "^6.3.0",
|
||||
"mongodb-client-encryption": "^6.0.0"
|
||||
}
|
||||
}
|
||||
@@ -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: [
|
||||
|
||||
Reference in New Issue
Block a user