Read sample documents
The learners collection is preloaded with names and scores.
db.learners.find()Explore MongoDB online with document queries and shell commands. Learn how collections store JSON-like documents and continue with practical database labs.
Start here
Load a task into the terminal, then press Enter to see the result. Each example works in the introductory session on this page.
The learners collection is preloaded with names and scores.
db.learners.find()Inspect the first learner document.
db.learners.findOne()Count all documents in the sample collection.
db.learners.countDocuments()Match a field using an equality filter.
db.learners.find({name: "Alex"})Add a learner, then query the collection again.
db.learners.insertOne({name: "Sam", score: 88})Change Alex’s score and inspect the result with find.
db.learners.updateOne({name: "Alex"}, {$set: {score: 95}})Remove one matching learner document.
db.learners.deleteOne({name: "Sam"})Discover the learners collection in the test database.
show collectionsNo setup needed
Explore MongoDB online with document queries and shell commands. Learn how collections store JSON-like documents and continue with practical database labs.
Start with the short command exercises above. When you are ready for a project, open the linked LabEx lab to work with real tools in an online Linux environment, with step-by-step guidance and immediate feedback.
Keep learning
Build on your MongoDB experiments with a structured skill tree. Explore the skills, choose a guided lab, and practice each concept in an online environment.
The introductory exercises use MongoDB-style document and collection commands. Sign in to the linked MongoDB lab to use a real database and continue with queries, indexes, and aggregation.
The introductory exercises are free. Sign in for a complete LabEx environment; session duration and resources depend on your lab and plan.
No local installation is required. Sign in and open the lab in a modern browser. Follow the lab instructions to configure software inside the environment.
This preview supports a limited command set. Sign in and launch the MongoDB lab for more commands, packages and services. Available software and permissions depend on the selected lab.
Follow the MongoDB Skill Tree for guided labs and challenges. Practice regularly, inspect command output and ask Labby for help.
Your next step
Continue with real tools, guided labs, and Labby assistance.