MongoDB 是什么?
MongoDB 是一个文档数据库,为简化应用程序的开发与扩展而设计。
您可以在以下环境运行 MongoDB:
MongoDB Atlas :用于云端 MongoDB 部署的完全托管服务
MongoDB Enterprise:基于订阅、自行管理的 MongoDB 版本
MongoDB Community:source-available、可免费使用以及自行管理的 MongoDB 版本
在 MongoDB 中处理您的数据
连接到您的部署
在 MongoDB Atlas 用户界面中访问部署,或者使用 MongoDB 手册中的驱动程序或MongoDB Shell (mongosh)连接。
要了解更多信息,请参阅 MongoDB 手册中的查找连接字符串。
插入、查询、更新或删除文档
通过 MongoDB Atlas 用户界面或 MongoDB Query API 执行 CRUD 操作 - 无论是否使用事务。
要了解更多信息,请参阅 MongoDB Atlas 文档中的创建、查看、更新和删除文档以及 MongoDB 手册中的MongoDB CRUD 操作。
对数据进行建模
设计数据模式以支持频繁的访问模式。您可以随时更新或实施您的模式。
要了解更多信息,请参阅 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']
导入数据
使用数据库工具从 CSV 或 JSON 文件导入数据。
要了解更多信息,请参阅 MongoDB Atlas 文档中的迁移或导入数据以及数据库工具文档中的mongoimport 。
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 } }, ])
对客户端进行身份验证
通过身份验证对用户、副本集节点或分片集群节点的身份进行验证。
要了解详情,请参阅 MongoDB Atlas 文档中的Atlas UI 身份验证和 MongoDB 手册中的身份验证。
控制对数据库的访问
启用基于角色的访问控制来托管整个数据库集群或单个collection上的用户权限。
要了解更多信息,请参阅 MongoDB Atlas 文档中的Atlas 用户界面授权和 MongoDB 手册中的基于角色的访问控制。
加密最敏感的数据
客户端字段级加密可在数据库使用数据时保护数据。字段在离开应用程序之前会被加密,从而通过网络、内存和静态方式为字段提供保护。
要了解更多信息,请参阅 MongoDB 手册中的客户端字段级加密。
借助 MongoDB 探索更多可能
探索适用于 MongoDB 的库和工具。