When I am developing against MongoDB I don’t want the server to run all the time and use up my memory. Instead, what I do is manually start/stop the server and specify config files so that it can run on various data directories.
To set it up, I downloaded MongoDB to
~/Downloads, and then extracted to a directory where I keep various apps:
Inside the MongoDB directory is a bin directory. I create a symbolic link to everything there from my home bin directory (
When I log in, the
~/.bashrc file in Kubuntu adds everything in
~/bin to the
$PATH. This way I can easily run mongod from the bash manually and specify a config file for mongod to use (so I can switch between database directories easily for different projects).