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
MongoDB Exercises
Exercise:
What type of database is MongoDB?MongoDB is a database. Submit Answer »
Start the Exercise
Leave a Reply