What is MongoDB?什么是MongoDB?
MongoDB is a document database designed for ease of application development and scaling.MongoDB是一个文档数据库,旨在简化应用程序开发和扩展。
Run MongoDB with
- MongoDB Atlas
fully managed in the cloud,完全在云中管理, the source available and free-to-use MongoDB Community, or可免费使用MongoDB社区版的源代码,或the MongoDB Enterprise Advanced subscription.MongoDB Enterprise Advanced订阅。

Work with your data in MongoDB在MongoDB中处理您的数据
Model your data为数据建模
Design your data schema to support frequent access patterns. 设计数据模式以支持频繁访问模式。You can update or enforce your schema at any point.您可以在任何时候更新或强制执行您的架构。
To learn more, see Data Modeling Introduction要了解更多信息,请参阅数据建模简介
Connect to MongoDB连接到MongoDB
Import data from CSV or JSON files into your MongoDB database.将CSV或JSON文件中的数据导入MongoDB数据库。
To learn more, see MongoDB Shell (mongosh)要了解更多信息,请参阅MongoDB Shell(mongosh
)
Insert, query, update, or delete documents插入、查询、更新或删除文档
Use the MongoDB Query API to perform CRUD operations on your data - with or without transactions.使用MongoDB Query API对数据执行CRUD操作,无论是否使用事务。
To learn more, see MongoDB CRUD Operations要了解更多信息,请参阅MongoDB CRUD操作
➜ mongosh --port 27017
Current Mongosh Log ID: 123a4bc5d67891011ef1213g
Connecting to: mongodb://127.0.0.1:27017/
For mongosh info see: https://www.mongodb.com/docs/mongodb-shell/
test> db.messages.insertMany([
{
message: "Hello World!",
author: "MongoDB",
comments: [],
_id: 1
}
])
{ acknowledged: true, insertedIds: { '0': 1 } }
test> db.messages.findOne({ _id: 1 })
{ _id: 1, message: 'Hello World!', author: 'MongoDB', comments: [] }
Aggregate your data聚合您的数据
Use aggregation pipelines to process your data in multiple stages and return the computed results.使用聚合管道在多个阶段处理数据并返回计算结果。
To learn more, see Aggregation Operations.要了解更多信息,请参阅聚合操作。
test> db.orders.insertMany([
{ "item" : "almonds", "price" : 12, "quantity" : 2 },
{ "item" : "pecans", "price" : 20, "quantity" : 1 },
])
test> db.inventory.insertMany([
{ "sku" : "almonds", "description": "product 1", "instock" : 120 },
{ "sku" : "cashews", "description": "product 3", "instock" : 60 },
{ "sku" : "pecans", "description": "product 4", "instock" : 70 }
])
test> db.orders.aggregate([
{ $match: { price: { $lt: 15 } } },
{ $lookup: {
from: "inventory",
localField: "item",
foreignField: "sku",
as: "inventory_docs"
} },
{ $sort: { price: 1 } },
])
Control access to your database控制对数据库的访问
Enable Role-Based Access Controls to manage user privileges on your entire database cluster or individual collections.启用基于角色的访问控制可以管理整个数据库群集或单个集合上的用户权限。
To learn more, see Role-Based Access Controls要了解更多信息,请参阅基于角色的访问控制
Encrypt your most sensitive data加密您最敏感的数据
Client-Side Field Level Encryption protects data while it is in-use by the database. 客户端字段级加密在数据库使用数据时保护数据。Fields are encrypted before they leave your application, protecting them over the network, in memory and at rest.字段在离开应用程序之前会被加密,从而通过网络、内存和休息时对其进行保护。
To learn more, see Client-Side Field Level Encryption.要了解更多信息,请参阅客户端字段级加密。

Go Further with MongoDB使用MongoDB更进一步
Explore libraries and tools for MongoDB.探索MongoDB的库和工具。
Use MongoDB in your application’s language在应用程序的语言中使用MongoDB
Visually explore your data with MongoDB Compass使用MongoDB Compass直观地浏览您的数据
Manage and monitor your deployments管理和监控您的部署