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.在云中完全管理MongoDB Atlas的情况下运行MongoDB。

Get started with MongoDB Atlas开始使用MongoDB Atlas
Warning警告
MongoDB 5.3 Release CandidatesMongoDB 5.3发布候选版本

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

What You Can Do你能做什么

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

1

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要了解更多信息,请参阅数据建模简介

2

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

3

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: [] }
1

Import your data导入您的数据

Import data from a CSV or JSON file with mongoimport.使用mongoimport从CSV或JSON文件导入数据。

To learn more, see mongoimport要了解更多信息,请参阅mongoimport

2

Aggregate your data汇总您的数据

Use aggregation pipelines to process your data in multiple stages and return the computed results.使用聚合管道在多个阶段处理数据并返回计算结果。

To learn more, see Aggregation要了解更多信息,请参阅聚合

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 Authentication要了解更多信息,请参阅身份验证

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 Role-Based Access Controls要了解更多信息,请参阅基于角色的访问控制

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要了解更多信息,请参阅客户端字段级加密

MongoDB Security
1

Deploy a replica set部署副本集

Provide redundancy and resilience for your database by deploying a replica set.通过部署副本集为数据库提供冗余和恢复能力。

To learn more, see Replication要了解更多信息,请参阅复制

2

Scale out your database扩展数据库

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

To learn more, see Sharding要了解更多信息,请参阅Sharding

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查看Ops管理器