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 »Records in a MongoDB database are called documents, and the field values may include numbers, strings, booleans, arrays, or even nested documents.
{
title: "Post Title 1",
body: "Body of post.",
category: "News",
likes: 1,
tags: ["news", "events"],
date: Date()
}
Our "Show MongoDB" tool makes it easy to demonstrate MongoDB. It shows both the code and the result.
Find all documents that have a category of "news".
db.posts.find( {category: "News"} )
Try it Yourself »
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!