Docs Home / Node.js

MongoDB Node.js Driver驱动程序

Introduction引言

Welcome to the documentation site for the official MongoDB Node.js driver. You can add the driver to your application to work with MongoDB in JavaScript or TypeScript. For more information about downloading and installing the Node.js driver, see Download and Install in the Get Started guide.欢迎访问官方MongoDB Node.js驱动程序的文档网站。您可以将驱动程序添加到您的应用程序中,以便在JavaScript或TypeScript中使用MongoDB。有关下载和安装Node.js驱动程序的更多信息,请参阅《快速入门》指南中的下载和安装

You can connect using the Node.js driver for deployments hosted in the following environments:您可以使用Node.js驱动程序连接以下环境中托管的部署:

  • 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开始使用

Learn how to establish a connection to MongoDB Atlas and begin working with data in the step-by-step Get Started tutorial.在分步入门教程中学习如何建立与MongoDB Atlas的连接并开始使用数据。

Connect to MongoDB连接到MongoDB

Learn how to create and configure a connection to a MongoDB deployment in the Connect to MongoDB section.连接到MongoDB部分了解如何创建和配置到MongoDB部署的连接。

Databases and Collections数据库和集合

Learn how to interact wth MongoDB databases and collections in the Databases and Collections section.数据库和集合部分学习如何与MongoDB数据库和集合交互。

Read and Write Data读取和写入数据

Learn how to find, update, and delete data in the CRUD section.了解如何在CRUD部分查找、更新和删除数据。

Transform Your Data with Aggregation使用聚合转换数据

Learn how to use the Node.js driver to perform aggregation operations in the Aggregation Operations section.聚合操作部分了解如何使用Node.js驱动程序执行聚合操作。

Data Formats数据格式

Learn how to work with BSON and other data formats in the Data Formats section.数据格式部分了解如何使用BSON和其他数据格式。

Optimize Queries with Indexes使用索引优化查询

Learn how to work with common types of indexes in the Indexes for Query Optimization section.查询优化索引部分了解如何使用常见类型的索引。

Run a Database Command运行数据库命令

Learn how to run a database command in the Run a Database Command section.运行数据库命令部分了解如何运行数据库命令。

MongoDB Search搜索

Learn how to run MongoDB Search queries in the Run a MongoDB Search Query section.运行MongoDB搜索查询部分了解如何运行MongoDB搜索搜索查询。

MongoDB Vector SearchMongoDB矢量搜索

Learn how to run MongoDB Vector Search queries in the Run a MongoDB Vector Search Query section.运行MongoDB矢量搜索查询一节中了解如何运行MongoDB矢量查询。

Monitoring and Logging监控和日志记录

Learn how to monitor changes to your application and write them to logs in the Monitoring and Logging section.了解如何监视应用程序的更改,并将其写入“监视和日志记录”部分中的日志。

Secure Your Data保护您的数据

Learn about ways you can authenticate your application and encrypt your data in the Security section.安全部分了解如何对应用程序进行身份验证和加密数据。

Reference参考

Find more information about Node.js driver versions, compatibility, and third-party tools in the Reference section.参考部分中查找有关Node.js驱动程序版本、兼容性和第三方工具的更多信息。

API Documentation文档

For detailed information about classes and methods in the MongoDB Node.js driver, see the MongoDB Node.js driver API documentation.有关MongoDB Node.js驱动程序中的类和方法的详细信息,请参阅MongoDB Node.js驱动程序API文档

Issues & Help

Learn how to report bugs, contribute to the driver, and to find help in the Issues & Help section.了解如何报告错误、为驱动程序做出贡献,以及在问题和帮助部分找到帮助。

Related Tools and Libraries相关工具和库

Object Document Mappers对象文档映射器

MongoDB and our partners provide several object-document mappers (ODMs) for Node.js that let developers work with MongoDB data as objects. One popular ODM is Mongoose, which helps enforce a semi-rigid schema at the application level and provides features to assist with data modeling and manipulation. MongoDB和合作伙伴为Node.js提供了几个对象文档映射器(ODM),让开发人员将MongoDB数据作为对象进行操作。一个流行的ODM是Mongoose,它有助于在应用程序级别实施半刚性模式,并提供有助于数据建模和操作的功能。Prisma, another ODM, helps ensure data consistency by offering a type-safe database client and an intuitive schema.Prisma是另一个ODM,通过提供类型安全的数据库客户端和直观的模式来帮助确保数据一致性。

For more information about using ODMs with MongoDB, see the following resources:有关在MongoDB中使用ODM的更多信息,请参阅以下资源:

Packages软件包

You can install the following packages to expand the functionality of the Node.js driver:您可以安装以下软件包来扩展Node.js驱动程序的功能:

Package软件包Description描述
bsonBSON serialization and deserialization library used by the official MongoDB Node.js driver官方MongoDB Node.js驱动程序使用的BSON序列化和反序列化库
kerberosC++ extension for Node.js that provides support for Kerberos authenticationNode.js的C++扩展,支持Kerberos身份验证
mongodb-client-encryptionLibrary for client-side encryption functionality客户端加密功能库
@mongodb-js/zstdZstandard compression library for Node.jsNode.js的Z标准压缩库

For information about each package's version compatibility, see the Component Support Matrix in the Node.js driver Github repository.有关每个包的版本兼容性的信息,请参阅Node.js驱动程序Github存储库中的组件支持矩阵

Learn学习

Visit the Developer Hub and MongoDB University to learn more about the Node.js driver.访问开发者中心和MongoDB大学,了解更多关于Node.js驱动程序的信息。

Developer Hub开发者中心

The Developer Hub provides tutorials and social engagement for developers.开发者中心为开发者提供教程和社交互动。

To learn how to use MongoDB features with the Node.js driver, see the How To's and Articles page.要了解如何将MongoDB功能与Node.js驱动程序一起使用,请参阅操作指南和文章页面

To ask questions and engage in discussions with fellow developers who use the Node.js driver, see the MongoDB communities on Reddit or Stack Overflow.要提问并与使用Node.js驱动程序的其他开发人员进行讨论,请参阅RedditStack Overflow上的MongoDB社区。

MongoDB University大学

MongoDB University provides free courses to teach everyone how to use MongoDB.MongoDB大学提供免费课程,教每个人如何使用MongoDB。

Take the Following Free Online Courses Taught by MongoDB Instructors参加MongoDB讲师教授的以下免费在线课程

MongoDB University Node.js Course graphicUsing MongoDB with Node.js将MongoDB与Node.js结合使用
Learn the essentials of Node.js application development with MongoDB.学习使用MongoDB开发Node.js应用程序的要点。
MongoDB Node.js Developer PathMongoDB Node.js开发人员路径
Gain a comprehensive understanding of Node.js application development, complex operations, interactions with MongoDB Atlas datasets, and more.全面了解Node.js应用程序开发、复杂操作、与MongoDB Atlas数据集的交互等。