MongoDB Get Started

Atlas, mongosh and Compass.

✍️ 2 exercises in this lesson
  1. Create a free cluster on MongoDB Atlas (cloud), or install MongoDB Community Server locally.
  2. Connect with the shell: mongosh "your-connection-string"
  3. Or use MongoDB Compass, a visual tool to browse and edit data.

The examples in this tutorial are mongosh commands.

Key Takeaways: MongoDB Get Started

Mastering MongoDB Get Started helps you write clean and reliable MongoDB code. Follow standard conventions, test edge cases, and keep logic simple. Try running the code example below and complete the exercises to build confidence.

MongoDB Get Started Code Example

MongoDB
// Show databases, switch to (or create) "school"
show dbs
use school

// Show collections in the current database
show collections
Output
admin   40.00 KiB
config  72.00 KiB
local   40.00 KiB
switched to db school
Run this example on your own computer. The "Get Started" lesson shows how to set it up.

MongoDB Get Started Practice Exercises

Check what you learned in “MongoDB Get Started”.

/ 2 solved
Fill in the blank

Switch to the "shop" database in mongosh.

 shop
✓ Correct! Not quite. Try again.
Multiple choice

What is MongoDB Atlas?

✓ Correct! Not quite. Try again.
to save your exercise progress.
Finished this lesson?
Mark it complete to track your progress.

Stuck on something?

Ask the community in the CodesInTech forum.

Need a developer?

Learning on your own is great — and when you need professional help, our team builds custom software, websites and mobile apps for clients worldwide.

Explore Our Services