MongoDB is a document database maintained by MongoDB Inc. that stores flexible, JSON-like documents instead of rigid rows and columns. It's the sixth most-used database in developer surveys, at roughly 24% usage share. It's especially popular in JavaScript-stack apps โ it's the "M" in MERN โ because its schema can evolve without formal migrations, which speeds up early-stage development.
The Mongo shell inserts and queries JSON-like documents directly โ no table schema to define up front.
db.users.insertOne({
name: "Ava Chen",
age: 27,
tags: ["admin", "beta_tester"]
});
// find users over 21, sorted by name
db.users.find({ age: { $gt: 21 } })
.sort({ name: 1 });
Run a local instance with Docker, then connect with the mongosh shell.
# Docker: run a local MongoDB instance
docker run --name mongo -p 27017:27017 -d mongo:7
# connect with the mongosh shell
mongosh "mongodb://localhost:27017"