MongoDB Tutorial
Learn MongoDB
MongoDB is a document database. It stores data in a type of JSON format called BSON.
If you are unfamiliar with JSON, check out our JSON tutorial.
A record in MongoDB is a document, which is a data structure composed of key value pairs similar to the structure of JSON objects.
Start learning MongoDB now »A MongoDB Document
Records in a MongoDB database are called documents, and the field values may include numbers, strings, booleans, arrays, or even nested documents.
Example Document
{
title: "Post Title 1",
body: "Body of post.",
category: "News",
likes: 1,
tags: ["news", "events"],
date: Date()
}
Learning by Examples
Our "Show MongoDB" tool makes it easy to demonstrate MongoDB. It shows both the code and the result.
Example
Find all documents that have a category of "news".
db.posts.find( {category: "News"} )
Try it Yourself »
Learning by Exercises
Track Your Progress
Create a free W3Schools account and get access to more features and learning materials:
View your completed tutorials, exercises, and quizzes
Keep an eye on your progress and daily streaks
Set goals and create learning paths
Create your own personal website
Note: This is an optional feature. You can study at W3Schools without creating an account.