-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript-for-customer.js
More file actions
21 lines (15 loc) · 1.34 KB
/
script-for-customer.js
File metadata and controls
21 lines (15 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
mongo <host> --eval 'db.serverStatus();' > statusForServer.json
mongo <host> --eval 'db.getMongo().getDBNames().forEach(function (d) {print("-- Database: " + d);var curr_db = db.getSiblingDB(d);printjson(curr_db.stats());curr_db.getCollectionNames().forEach(function (coll, d) { print("|- Collection in database: " + coll);var c = curr_db.getCollection(coll); if (typeof c != "function") { printjson(c.stats()); printjson(c.getIndexes()); } });});' > statusForServer.json
mongo --eval 'db.getMongo().getDBNames().forEach(function (d) {print("-- Database: " + d);var curr_db = db.getSiblingDB(d);printjson(curr_db.stats());curr_db.getCollectionInfos().forEach(function (coll, d) {print("|- Collection in database: " + coll.name);var c = curr_db.getCollection(coll.name); if (typeof c != "function" && coll.type != "view"){ try { printjson(c.stats()); printjson(c.getIndexes());} catch (e) {} } });});' > statusForServer.txt
db.getMongo().getDBNames().forEach(function (d) {
print("-- Database: " + d);
var curr_db = db.getSiblingDB(d);
printjson(curr_db.stats());
curr_db.getCollectionNames().forEach(function (coll, d) {
print("|- Collection in database: " + coll);
var c = curr_db.getCollection(coll);
if (typeof c != "function") {
printjson(c.stats()); printjson(c.getIndexes());
}
});
});