A Mongo Shell Cheat Sheet

There’s a whole host of GUI tools to connect to MongoDB databases and browse, however despite a steeper learning curve, I’ve always found myself more productive using a command line interface (CLI).

Then, there’s that moment when something has gone wrong on the database server, and we need to SSH 4-levels deep in order to debug a problem with a database. Sometimes, there’s no other option available, and this makes familiarity with the CLI invaluable.

I learn best by example, and I’ve kept this cheat sheet of commands I use most often by my desk for many years – there’s always one command I’ve forgotten.

Together with the Red Hat Developer Team, I’ve put together this handy cheat sheet – hopefully, you’ll find it useful too!

@cianclarke is a Software Engineer with Red Hat Mobile. Primarily focused on the mobile-backend-as-a-service space, Cian is responsible for many of Red Hat’s mBaaS developer features.

Join Red Hat Developers, a developer program for you to learn, share, and code faster – and get access to Red Hat software for your development.  The developer program and software are both free!


Leave a Reply