OneCompiler

MongoDB

Learn MongoDB by running real queries in mongosh against a live database. Each short lesson ends with an exercise you solve in the editor.

7 sections·32 items·Beginner
This course includes
  • 33 practice problems
  • 32 lessons
  • Free — runs in your browser, no setup

What you'll learn

Understand documents, collections and the _id field
Find documents with filters, operators, projections and sorting
Insert, update, upsert and delete documents
Work with nested documents, arrays and dates
Summarize data with aggregation pipelines and join collections with $lookup
Choose between embedding and referencing, and speed up queries with indexes

Syllabus

About this course

MongoDB is a document database, and one of the most popular databases today. It does not keep data in tables with fixed columns. Instead, it stores each record as a document, which looks like a JavaScript object. A document can hold lists and other documents, and two documents in the same collection can have different fields.

In this course you run real queries in mongosh, the MongoDB shell, against a live MongoDB database. Each lesson is short and ends with an exercise in the editor. You will use a small collection of movies the whole way. You will find and filter documents, change them, and work with nested data, lists and dates. Then you will summarize data with aggregation pipelines and join collections. The course ends with how to design your documents and how indexes make queries fast.

You do not need any database experience. A little JavaScript helps, but you do not need it.