MongoDB databases in plain English
In MongoDB, a database holds collections, and collections hold documents (JSON-like BSON records). Unlike some SQL engines, MongoDB can create a database lazily when you first write data — but being explicit helps teams stay organized.
This guide shows three practical ways to create a database: local mongosh, MongoDB Atlas, and Docker.
Option 1 — Create a database with mongosh
- Start MongoDB locally (or connect to a remote URI).
- Open the shell:
mongosh - Switch context:
use my_app_db - Create the first collection by inserting a document:
db.users.insertOne({ email: "demo [at] example.com", createdAt: new Date() }) - Verify:
show dbsandshow collections
Until you insert data (or explicitly create a collection), some listings may hide an empty database. That is expected.
Option 2 — Create a database in MongoDB Atlas
- Create a free/shared cluster.
- Add a database user and network access rule.
- Open Browse Collections → Create Database.
- Provide database and collection names, then insert a sample document.
- Copy the connection string into your app
MONGODB_URI.
Option 3 — Docker quick start
docker run -d --name mongo -p 27017:27017 mongo:7
docker exec -it mongo mongosh
use demo_db
db.products.insertOne({ name: "Theme", price: 0 })
Naming and structure tips
- Use lowercase names with underscores or clear product prefixes.
- Keep one database per application environment (dev/staging/prod).
- Design collections around access patterns, not rigid SQL table clones.
- Add indexes after you know query filters (email, slug, status).
Verify from your application
With Node drivers or Mongoose, connecting with a URI that includes the database name (or calling useDb) ensures writes land in the intended place. Always confirm in Compass or mongosh after the first migration/seed.
Common mistakes
Typos in database names (this slug historically used “databsae”), writing to test by accident, and opening production clusters without IP allowlists. Double-check URI database segments before deploying.



