MongoDB Cheat Sheet - Essential MongoDB Shell Commands

Here are the most commonly used Mongo Shell commands with example usage.

Basic Commands

Show Commands

CRUD Operations

Index

Cursor Methods

Comparison Operators

Logical Operators

Element Operators

[1] Databases are created on the fly and will actually be created when you insert something into it.

[2] Collections are created on the fly when you insert first document into it.

Related Articles

Post a comment

Post Comment Post Reply

Comments

Ramaj | April 11, 2020 11:00 AM |

Thanks for this post, It's short and very helpful

Lolita Love | April 29, 2020 7:44 AM |

I think the same, very helpful.

brian | July 13, 2019 2:45 AM |

awesome write up

@89rtE | October 2, 2017 3:30 PM |

Lots of HW, GZ. THX.

Shy Tamir | December 29, 2016 10:46 AM |

You might want to add this little gem for validation of data files. I use it on our restored daily backup to verify it's usable: db.getSiblingDB("admin").runCommand("listDatabases").databases.forEach(function(d))>)