Merge pull request #3713 from Rabson/fix/diagnostics-totalsize-undefined

fix: (diagnostics) derive Mongo totalSize when dbStats omits it (Atlas shared tier)
This commit is contained in:
Alexander Holliday authored and GitHub committed 2026-06-09 09:09:47 -07:00
commit 0fb210e9e1
2 files changed
+40 -4

No files matched your search

@@ -87,9 +87,9 @@ export class DiagnosticService implements IDiagnosticService {
const entry: CollectionDiagnostics = {
name: collection.collectionName,
documentCount,
storageSize: stats.storageSize,
totalIndexSize: stats.totalIndexSize,
totalSize: stats.totalSize,
storageSize: stats.storageSize ?? 0,
totalIndexSize: stats.totalIndexSize ?? 0,
totalSize: stats.totalSize ?? (stats.storageSize ?? 0) + (stats.totalIndexSize ?? 0),
};
if (stats.timeseries?.bucketCount !== undefined) {
entry.bucketCount = stats.timeseries.bucketCount;
@@ -103,7 +103,7 @@ export class DiagnosticService implements IDiagnosticService {
host: mongo.connection.host,
port: mongo.connection.port,
dbName: mongo.connection.name,
totalSize: dbStats.totalSize,
totalSize: dbStats.totalSize ?? (dbStats.storageSize ?? 0) + (dbStats.indexSize ?? 0),
collections,
};
};