Here is a MongoDB script for presenting index information in a more concise way than getIndexes() provides. This script also presents an index’s total size along with a breakdown of its size on all of the shards. //mongo --eval="var collection='file';" var ret = db[collection].getIndexes().map(function(i){ return {"key":i.key, "name":i.name}; }); var o […]
mongodb
Here is a handy script I’ve been using for MongoDB to retrieve a list of all the fields used in a collection. This uses a map/reduce routine and has to comb over all the documents in a collection so you may want to exercise caution when using this script. // […]