From 1451a38be88bf8bacf696e9acc3be8cdf2311c44 Mon Sep 17 00:00:00 2001 From: midoks Date: Mon, 13 Jun 2022 13:50:30 +0800 Subject: [PATCH] Update index.py --- plugins/mongodb/index.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/mongodb/index.py b/plugins/mongodb/index.py index 7a1a036d5..0c80768c5 100755 --- a/plugins/mongodb/index.py +++ b/plugins/mongodb/index.py @@ -202,11 +202,17 @@ def runInfo(): result["uptime"] = serverStatus['uptime'] result['db_path'] = '/var/lib/mongo' + + if os.path.exists("/var/lib/mongodb"): + result['db_path'] = '/var/lib/mongodb' + if mw.isAppleSystem(): result['db_path'] = getServerDir() + "/data" result["connections"] = serverStatus['connections']['current'] - result["collections"] = serverStatus['catalogStats']['collections'] + + if 'catalogStats' in serverStatus: + result["collections"] = serverStatus['catalogStats']['collections'] result["dbs"] = showDbList return mw.getJson(result)