Can someone help to get sum of sizes of all Databases sizes. Just need to tune below query to get SUM of mdb.stats(102410241024).storageSize . Kindly Help in resolving this.
db.adminCommand("listDatabases").databases.
filter(
n => !['admin', 'config', 'local'].includes(n.name)).
reduce(
(b,a) => b + db.getSiblingDB(a.name).stats(1024*1024*1024).storageSize, 0)
However I believe this is mainly a Javascript question by now, as this method is not limited to MongoDB, but general Javascript operation on any array of objects.
I suggest if you’re having issues with Javascript coding, you might want to ask the relevant questions in a programming-oriented site such as StackOverflow.