PSA: For anyone attempting to use MongoDB on C9 and having issues

Apparently C9 has an issue with their current image, in which the .bashrc file has an incorrect alias for mongod.

Until they fix, you can follow the steps below or edit the .bashrc to get it working again. Really made a headache working on the learnyoumongo projects!

1 Like

To remove the bad alias from the ~/.bashrc_aliases file, type the following in bash:

vim ~/.bashrc_aliases

Then key down to the mongod alias and press the A key on the keyboard. This puts you in insert mode on the editor. remove everything after the equals sign and copy/paste in this:

'mongod --bind_ip=$IP --dbpath=data --nojournal --rest "$@"'

Note that the dbpath can be whatever path you would like.

Once you’ve copied in that change, press the ESC key. Then type in :wq and press enter. This should save the changes.

Finally, exit the current bash terminal, and start a new one using Alt+T. You should now be able to use the mongod alias as normal.

Note: any changes made to the ~/.bashrc_aliases file requires a restart of the terminal.

Yeah, this really slowed me down on thelearnyoumongo module.

For the microservices I decided to jump ship and set up my own local dev tools instead - pretty happy this encouraged me to make the jump in the end, since everything runs a little snappier locally than on c9 anyway.