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!

Everything you need to grow your career.

With your free Red Hat Developer program membership, unlock our library of cheat sheets and ebooks on next-generation application development.


@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 the Red Hat Developer Program (it’s free) and get access to related cheat sheets, books, and product downloads.