Stage 1 · Lesson 6 of 8
mongosh, the MongoDB shell
is the MongoDB shell: a command-line client where you type commands and see results. It is built on , so it understands JavaScript, and every example in this roadmap outside the application stage uses its syntax so it works whatever language you choose.
Connect with a , then learn the basics: show dbs, use shop, show collections, db.products.findOne() and exit. db always means the current database. find() shows 20 documents at a time; type it for more.
You can also run a script file with load("seed.js"). Servers, and deployment scripts rarely have a graphical tool, so this is the client you will always have.
Common traptyping use shop and assuming the database exists: MongoDB creates it only when you first write data into it.
A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock
Resources for this stage
Start with
- CourseFreeMongoDB University
MongoDB
Free: start with the introduction to MongoDB and Atlas setup lessons, which use the same sample data
Practise
Keep handy
Also worth your time
A balanced comparison of where a document database fits and where a relational one wins