MongoDB tutorials
MongoDB Tutorials: Learn MongoDB Step by Step
Every MongoDB tutorial on DatabaseFAQs.com, grouped by topic. Install MongoDB, create a database and collections, then learn find queries, updates and the aggregation pipeline.
Our newer examples are run in mongosh against a local MongoDB server.
- 63free MongoDB tutorials
- 8topics
- Oct 2026last updated
New to MongoDB? Start here
Read these in order. Each one builds on the one before it.
- How to install MongoDBInstall MongoDB Community Server.
- How To Install MongoDB CompassInstall Compass, the MongoDB GUI.
- How to Create a Database in MongoDBCreate a database and your first collection.
- MongoDB Update Documents – Complete tutorialInsert and update documents.
- MongoDB find multiple conditionsQuery documents with filters.
- MongoDB Aggregate Count: countDocuments(), $count and Group By CountsSummarize data with aggregation.
The basics5
What it is, what it's good for, and the questions people ask before they commit to it.
Install, connect and tools4
Install it, connect to it, and get your tools working.
SELECT queries, filtering and grouping10
Read data with SELECT, filter it, sort it and summarize it.
Collections and documents (CRUD)18
Create, read, update and delete documents and collections.
- Display MongoDB data in HTML
- How to change collection name in MongoDB
- How to compare two fields in MongoDB
- How to Create a Table in MongoDB (db.createCollection, Schema Validation, Keys)
- How to create auto increment id in MongoDB
- How to delete documents in MongoDB
- How to find document by id in MongoDB
- How to get collection size in MongoDB
- How to get id from mongodb after insert
- How to remove a field from a document in MongoDB
- How to remove element from Array in MongoDB
- How to store images in MongoDB
- MongoDB check if the document exists
- MongoDB drop collection
- MongoDB find last inserted document
- MongoDB return specific fields
- Select the first element in an array in MongoDB
- MongoDB Update Documents – Complete tutorial
Aggregation, grouping and sorting8
Group, count, sort and join data with the aggregation pipeline.
Backup, import/export and administration8
Back up, restore, import, export, migrate and monitor.
Errors and fixes9
The exact error message, what causes it and the steps that fix it.
- Missing before statement MongoDB
- MongoDB data directory /data/db not found
- MongoDB failed to connect
- MongoDB is not recognized as an internal or external command
- MongoDB shutting down with code 100
- MongoDB shutting down with code 48
- SocketException: Address already in use MongoDB
- Sub-process /usr/bin/dpkg returned an error code (1)
- Unable to locate package mongodb-org
Comparisons1
Side-by-side comparisons to help you choose.
Other database tutorials
Looking for everything, newest first? See the full tutorial list.
Frequently Asked Questions
Is MongoDB free?
MongoDB Community Server is free to download and use. MongoDB also offers a paid Enterprise edition and the Atlas cloud service, which has a free starter tier.
Is MongoDB a relational database?
No. MongoDB is a document database that stores JSON-like documents in collections instead of rows in tables. It can still join collections with the $lookup aggregation stage.
Where should a beginner start?
Install MongoDB and Compass, create a database, then learn inserts, updates, find queries and aggregation, in the order shown at the top of this page.