MongoDB Terminal Simulator
Practice MongoDB queries in an interactive browser terminal. Learn find and projections, query operators like $lt, $gt, and $in, sort, skip, limit, countDocuments, insert, update, delete, and the aggregation pipeline with $match, $group, and $sort, against a small e-commerce dataset that runs live in your browser.
Category: Database
What You Will Learn
- Read documents with find() and filter them with a query document
- Return only the fields you need with a projection
- Compare values with $lt, $gt, $gte, $lte, and match a set with $in
- Shape a cursor with sort, skip, and limit for ordering and pagination
- Count matches with countDocuments without pulling the documents back
- Write data with insertOne, updateOne, and deleteMany and read the results
- Summarise documents with an aggregation pipeline: $match, $group, and $sort
- Test yourself in Challenge mode by writing queries from a plain-English prompt
Topics covered: mongodb, nosql, mongo, database, documents, find, aggregation, queries, terminal, backend, educational, interactive
// simulator
MongoDB Terminal Simulator
Practice MongoDB queries in an interactive browser terminal. Learn find and projections, query operators like $lt, $gt, and $in, sort, skip, limit, countDocuments, insert, update, delete, and the aggregation pipeline with $match, $group, and $sort, against a small e-commerce dataset that runs live in your browser.
// mongo shell playground
MongoDB Terminal Simulator
Practice MongoDB queries against a small e-commerce dataset in a safe browser terminal. Every command runs live: filter and project with find(), shape the cursor with sort, skip, and limit, write with insertOne, updateOne, and deleteMany, and summarise with the aggregation pipeline. The data mirrors the SQL simulator, so you can see the same records as documents.
3
Collections
30
Documents
10
Lessons
Return every document in the customers collection.
Welcome to the MongoDB shell playground.
Type "help", run "show collections", or follow the current task above.
customers
- _idint
- namestring
- countrystring
- signupDatestring
products
- _idint
- namestring
- categorystring
- pricedouble
orders
- _idint
- customerIdint
- datestring
- statusstring
- itemsarray
find(filter, projection) read documents
{ field: 1, _id: 0 } include / exclude fields
$lt $gt $gte $lte $ne comparisons
$in / $and / $or combine
sort / skip / limit shape the cursor
countDocuments(filter) count matches
insertOne / updateOne / deleteMany write
aggregate([ $match, $group, $sort ]) pipeline
About this MongoDB simulator
What you'll learn
- How find() reads documents and how a query document filters them
- How projections return only the fields you want, and how _id behaves
- How operators like $lt, $gt, $in, $and, and $or express conditions
- How sort, skip, and limit order and paginate a cursor
- How countDocuments answers "how many" without returning the documents
- How insertOne, updateOne, and deleteMany change data and what they return
- How the aggregation pipeline groups and summarises with $match, $group, and $sort
Key operations covered
- Read: find, findOne, query documents, projections, dot-notation fields
- Filter: $eq, $ne, $lt, $gt, $gte, $lte, $in, $nin, $exists, $and, $or
- Shape: sort, skip, limit, countDocuments
- Aggregate: $match, $group with $sum and $avg, $sort, $project, $count
- Write: insertOne, insertMany, updateOne, updateMany, deleteOne, deleteMany
How the playground runs your queries
Every command runs live in your browser against three small collections (customers, products, orders), evaluated by a lightweight query and aggregation engine. Nothing is sent to a server, so you can experiment freely. The data mirrors the SQL simulator's tables, so you can compare how the same records look as documents versus rows.
Practice on a real MongoDB
A simulator builds intuition fast, but running these against a real database makes them stick. You can spin up a free cluster on MongoDB Atlas or run managed MongoDB on DigitalOcean (new accounts get $200 in credits), then paste the same commands into mongosh to run them for real.
Prefer SQL, or want to compare?
The SQL Terminal Simulator uses the same e-commerce data as tables, so you can see the exact difference between a document find() and a SQL SELECT. The Database Types Simulator explains when a document database is the right tool in the first place.
Why learn MongoDB this way?
- Document queries click fastest when you can change a filter and see the documents change.
- find(), projections, and the aggregation pipeline cover most day-to-day MongoDB work.
- Reading real results builds the instinct you need for app code, debugging, and interviews.
Try next
// simulator
SQL Terminal Simulator
Practice SQL in an interactive browser terminal. Learn SELECT, WHERE, ORDER BY, DISTINCT, aggregates, GROUP BY, HAVING, JOINs, subqueries, and window functions against a small e-commerce schema, with single-table queries evaluated live and verified Postgres output.
// simulator
PostgreSQL Terminal Simulator
Practice the psql tool and Postgres engine in an interactive browser terminal. Explore with meta-commands, read real EXPLAIN plans, add an index to turn a sequential scan into a bitmap index scan, and use BEGIN and ROLLBACK to make changes safe, all against a small e-commerce database with verified PostgreSQL output.
// simulator
Database Indexing Simulator
Learn how database indexes work with an interactive simulator. See the difference between full table scans and index seeks, understand B-tree structure, and learn when to create indexes.