MongoDB

Stage 1 of 8 · 8 lessons · ~2 weeks

Documents and your setup

Learn what documents, BSON and collections are and when MongoDB is the right fit, then set up a free Atlas cluster or a local server with mongosh and Compass, and load a sample dataset to practise on.

Start: Documents, fields and the document model

Lessons· one lesson for each topic, in this order

  1. 1Documents, fields and the document model
  2. 2When MongoDB fits, and when it does not
  3. 3BSON and data types
  4. 4The _id field and ObjectId
  5. 5An Atlas free cluster or a local server
  6. 6mongosh, the MongoDB shell
  7. 7Compass as your GUI
  8. 8Loading a sample dataset

Do this

  • Create an Atlas free cluster, or install a current 8.x Community Server locally or in Docker.
  • Connect with mongosh and run show dbs, use and show collections.
  • Connect Compass and open the Schema tab on one collection.
  • Load a sample dataset and open a few documents from three collections.
  • Insert one document with a Date, a Decimal128 and a nested array, then read it back.
  • Write down one application where MongoDB fits and one where it does not.
  • Start a Git repository for every script you write in this roadmap.

Start with

  • CourseFree
    MongoDB University

    MongoDB

    Free: start with the introduction to MongoDB and Atlas setup lessons, which use the same sample data

Practise

  • Paste a few documents and a query and run it in the browser, no install needed

Keep handy

  • The mongosh docs: connecting, running scripts and the shell helpers such as show and use

  • The Compass docs for the Schema, Explain Plan and Aggregations tabs you will use later

Also worth your time

Before moving on: MongoDB running on an Atlas free cluster or locally, mongosh and Compass both connected, a sample dataset loaded, and a short note describing three of its collections, their nested fields and one field whose type varies.

Tauseef's advice
Learn mongosh properly even though Compass is friendlier: every query, index and pipeline in this roadmap is easier to understand when you have typed it yourself. And keep every script you write in a Git repository from day one, so you can rerun it against a fresh cluster.

Mark this stage as not done?