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. // […]
administration
Recently I found the need to create an init.d script and since I had a hard time finding an example elsewhere1, here’s the overly simple script I came up with to get the job done: #!/bin/bash # myapp daemon # chkconfig: 345 20 80 # description: myapp daemon # processname: […]
Simple init.d script template
Here is a simple script I’ve found to be quite helpful for monitoring the status of background index builds across shards on a system: var currentOps = db.currentOp(); if(!currentOps.inprog || currentOps.inprog.length < 1) { print("No operations in progress"); } else { for(o in currentOps.inprog) { var op = currentOps.inprog[o]; if(op.msg […]