What is MongoDB?MongoDB是什么?

MongoDB is a document database designed for ease of application development and scaling.MongoDB是一个文档数据库,旨在简化应用程序开发和扩展。

You can run MongoDB in the following environments:您可以在以下环境中运行MongoDB:

  • MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud:云中MongoDB部署的完全托管服务

  • MongoDB Enterprise企业版: The subscription-based, self-managed version of MongoDB:MongoDB的基于订阅的自我管理版本

  • MongoDB Community社区版: The source-available, free-to-use, and self-managed version of MongoDB:MongoDB的源代码可用、免费使用和自我管理版本

Get started with MongoDB Atlas开始使用MongoDB Atlas

Warning

MongoDB 8.3 Not Yet AvailableMongoDB 8.3尚未推出

MongoDB 8.3 release candidates are not yet available. This version of the manual is for an upcoming release and is currently a work in progress.MongoDB 8.3候选版本尚未发布。此版本的手册适用于即将发布的版本,目前正在进行中。

Homepage hero image
What You Can Do你能做什么

Work with your data in MongoDB在MongoDB中处理您的数据

1

Deploy MongoDB部署MongoDB

Create a cluster in the MongoDB Atlas UI or the Atlas CLI quickly and easily. 在MongoDB Atlas UI或Atlas CLI中快速轻松地创建集群。To learn more, see Create a Cluster in the MongoDB Atlas documentation and Get Started with Atlas in the Atlas CLI documentation.要了解更多信息,请参阅MongoDB Atlas文档中的创建集群和Atlas CLI文档中的Atlas入门

For self-hosted deployments, see Replication in the MongoDB manual to create a replica set.对于自托管部署,请参阅MongoDB手册中的复制以创建副本集。

2

Connect to your deployment连接到部署

Access deployments in the MongoDB Atlas UI or connect with drivers or the MongoDB Shell (mongosh) in the MongoDB manual.访问MongoDB Atlas UI中的部署,或连接MongoDB手册中的驱动程序MongoDB Shellmongosh)。

To learn more, see Find Your Connection String in the MongoDB manual.要了解更多信息,请参阅MongoDB手册中的查找连接字符串

3

Insert, query, update, or delete documents插入、查询、更新或删除文档

Perform CRUD operations in the MongoDB Atlas UI or by using the MongoDB Query API - with or without transactions.在MongoDB Atlas UI中或通过使用MongoDB Query API执行CRUD操作-无论是否有事务。

To learn more, see Create, View, Update, and Delete Documents in the MongoDB Atlas documentation and MongoDB CRUD Operations in the MongoDB manual.要了解更多信息,请参阅MongoDB Atlas文档中的创建、查看、更新和删除文档以及MongoDB手册中的MongoDB CRUD操作

4

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 in the MongoDB manual.要了解更多信息,请参阅MongoDB手册中的数据建模介绍

➜ atlas setup
? Do you want to setup your Atlas database with default settings? (Y/n)
➜ Y

We are deploying Cluster9876543...
Please store your database authentication access details in a secure location.
Database User Username: Cluster9876543
Database User Password: abcdef12345
Creating your cluster... [Its safe to 'Ctrl + C']
1

Import your data导入数据

Import data from a CSV or JSON file with database tools.使用数据库工具从CSV或JSON文件导入数据。

To learn more, see Migrate or Import Data in the MongoDB Atlas documentation and mongoimport in the database tools documentation.要了解更多信息,请参阅MongoDB Atlas文档中的迁移或导入数据以及数据库工具文档中的mongoimport

2

Aggregate your data聚合数据

Use aggregation pipelines to process your data in multiple stages and return the computed results. You can preview the results at each pipeline stage when you run aggregation pipelines in MongoDB Atlas.使用聚合管道在多个阶段处理数据并返回计算结果。在MongoDB Atlas中运行聚合管道时,您可以在每个管道阶段预览结果。

To learn more, see Run Aggregation Pipelines in the MongoDB Atlas documentation and Aggregation Operations in the MongoDB manual.要了解更多信息,请参阅MongoDB Atlas文档中的运行聚合管道和MongoDB手册中的聚合操作

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 } },
])
1

Authenticate a client对客户端进行身份验证

Verify the identity of a user, replica set member, or sharded cluster member with authentication.通过身份验证验证用户、副本集成员或分片群集成员的身份。

To learn more, see Atlas UI Authenication in the MongoDB Atlas documentation and Authentication in the MongoDB manual.要了解更多信息,请参阅MongoDB Atlas文档中的Atlas UI身份验证和MongoDB手册中的身份验证

2

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 Atlas UI Authorization in the MongoDB Atlas documentation and Role-Based Access Controls in the MongoDB manual.要了解更多信息,请参阅MongoDB Atlas文档中的Atlas UI授权和MongoDB手册中的基于角色的访问控制

3

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 in the MongoDB manual.要了解更多信息,请参阅MongoDB手册中的客户端字段级加密

MongoDB Security
1

Create a cluster创建集群

Create a free cluster, or an auto-scaling cluster in the MongoDB Atlas UI. To learn more, see Choose a Cluster Type in the MongoDB Atlas documentation.在MongoDB Atlas UI中创建一个免费集群或自动扩展集群。要了解更多信息,请参阅MongoDB Atlas文档中的“选择集群类型”。

For self-hosted deployments, provide redundancy and resilience for your database by deploying a replica set. To learn more, see Replication in the MongoDB manual.对于自托管部署,通过部署副本集为数据库提供冗余和弹性。要了解更多信息,请参阅MongoDB手册中的复制

2

Scale out your database扩展数据库

Use sharding to horizontally scale your database or to ensure location-based separation of data.使用分片来水平扩展数据库或确保基于位置的数据分离。

To learn more, see Shard a Collection in the MongoDB Atlas documentation and Sharding in the MongoDB manual.要了解更多信息,请参阅MongoDB Atlas文档中的分片某个集合和MongoDB手册中的分片

MongoDB Deploy and Scale
Related Products & Resources相关产品和资源

Go Further with MongoDB使用MongoDB走得更远

Explore libraries and tools for MongoDB.探索MongoDB的库和工具。

MongoDB Atlas icon

Use MongoDB in your application's language在应用程序的语言中使用MongoDB

Learn about Drivers了解驱动程序

MongoDB University icon

Visually explore your data with MongoDB Compass使用MongoDB Compass直观地探索您的数据

View Compass Docs查看Compass文档

MongoDB Server icon

Manage and monitor your deployments管理和监控您的部署

View Ops Manager查看运营管理器