Last active
December 12, 2018 18:51
-
-
Save alexbevi/a45abda7c332fe1c2272f44833db9c06 to your computer and use it in GitHub Desktop.
Scripts I've found useful while working with MongoDB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*********** | |
* Useful for finding out which xxxxxxx.wt files represent a collection in the dbpath | |
* | |
* output sample: | |
* admin.system.users - statistics:table:collection-14--2861149510510481026 | |
* admin.system.version - statistics:table:collection-9--2861149510510481026 | |
* local.me - statistics:table:collection-2--2861149510510481026 | |
* local.oplog.rs - statistics:table:collection-4--2861149510510481026 | |
* local.replset.election - statistics:table:collection-12--2861149510510481026 | |
* local.replset.minvalid - statistics:table:collection-7--2861149510510481026 | |
* local.startup_log - statistics:table:collection-0--2861149510510481026 | |
* local.system.replset - statistics:table:collection-5--2861149510510481026 | |
* test.test1 - statistics:table:collection-0-6090637249784447374 | |
* test.test2 - statistics:table:collection-2-6090637249784447374 | |
/******** | |
db.adminCommand({listDatabases: 1}).databases.forEach(function(d) { | |
var database = db.getSiblingDB(d.name); | |
database.getCollectionNames().forEach(function(c) { | |
print(d.name + "." + c + " - " + database.getCollection(c).stats().wiredTiger.uri); | |
}); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment