Typorithm · easy

Connect & Navigate

mongosh-connectmongodbconnectnavigateshell
Saved on this device
Full lesson · 8 learning steps Open any exercise for focused practice
1

Step 1 of 8 · intro card

Learn Connect & Navigate

0%

mongosh

Start mongosh against a connection URI, then use show dbs, use <db>, and show collections to move around the server.

mongosh is the modern MongoDB shell; you launch it with a connection string like mongodb://localhost:27017.

Once connected, show dbs lists the databases and use <db> sets the one your commands operate on.

show collections then reveals the collections inside the current database so you know what you can query.

01

mongosh <uri> opens the shell.

02

show dbs lists databases.

03

use <db> switches the current database.

mongosh "mongodb://localhost:27017"
show dbs
use shop
show collections

Read the implementation

Connect each part of the code to the concept before you type.

1. Connection URI

mongosh opens an interactive shell against the connection string; mongodb://host:port points at the server.

mongosh "mongodb://localhost:27017"

2. List databases

show dbs lists the databases on the server along with their on-disk size.

show dbs

3. Switch database

use <db> selects the current database; the named db is created lazily on first write.

use shop

4. List collections

show collections lists the collections inside the database you are currently using.

show collections

A complete learning loop

01

Understand

Read the concept map and follow the code breakdown.

02

Reconstruct

Type the implementation, repair mistakes and work through every recall exercise.

03

Verify

Use the final check without hints; revisit weak concepts in short practice sessions.

Connect & Navigate: Lesson & Practice · Typorithm | ApplyDjinn