Database Manual / Introduction

MongoDB Query 查询API

The MongoDB Query API is the mechanism that you use to interact with your data.MongoDB Query API是用于与数据交互的机制。

The Query API comprises two ways to query data in MongoDB:查询API包括两种在MongoDB中查询数据的方法:

You can use the Query API to perform:您可以使用查询API来执行:

Document Model文档模型

A document in MongoDB is a data structure composed of field and value pairs. Documents are stored as BSON which is the binary representation of JSON. MongoDB中的文档是由字段和值对组成的数据结构。文档存储为JSON的二进制表示形式BSON。This low level of abstraction helps you develop quicker and reduces the efforts around querying and data modeling. The document model provides several advantages, including:这种低层次的抽象可以帮助您更快地开发,并减少查询和数据建模的工作量。文档模型提供了几个优点,包括:

  • Documents correspond to native data types in many programming languages.文档对应于许多编程语言中的本机数据类型。
  • Embedded documents and arrays reduce need for expensive joins.嵌入式文档和数组减少了对昂贵连接的需求。
  • Flexible schema. Documents do not need to have the same set of fields and the data type for a field can differ across documents within a collection.灵活的架构。文档不需要具有相同的字段集,字段的数据类型可能因集合中的文档而异。

Data as Code数据作为代码

The MongoDB Query API supports drivers for major programming languages. These drivers allow you to make calls to the database and generate queries using the syntax native to your application.MongoDB Query API支持主要编程语言的驱动程序。这些驱动程序允许您调用数据库,并使用应用程序的原生语法生成查询。

Getting Started入门指南

To get started, visit the MongoDB Getting Started Guide. Here you can find resources, code examples and tutorials that demonstrate the MongoDB Query API.要开始使用,请访问MongoDB入门指南。在这里,您可以找到演示MongoDB Query API的资源、代码示例和教程。