The MongoDB Query API is the mechanism that you use to interact with your data.
The Query API comprises two ways to query data in MongoDB:
You can use the Query API to perform:
Data transformations. Use aggregation pipelines to reshape your data and perform calculations.
Full-text search. Use the
$searchstage to perform efficient text search on your data.
Indexing. Improve your MongoDB query performance by using the correct index type for your data architecture.
Time series analysis. Query and aggregate your time-stamped data with time series collections.
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. 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.
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.
To get started, visit the MongoDB Getting Started Guide. Here you can find resources, code examples and tutorials that demonstrate the MongoDB Query API.