MongoDB Query API

Work with data as code to build any class of application faster – from high-throughput transactions and search to sophisticated real-time analytics.

The easiest and most natural way to work with data

Why use MongoDB Query API?


Purpose-built to handle data of any structure - query, transform, and analyze it as your schema evolves.


Quickly index, query, and update any element of a document in place.

Easy to use

Modular and composable to programmatically generate queries in your programming language of choice.

What can I do with MongoDB Query API?

Query and update

Quickly query and update documents in your collection with powerful operators like $updateMany and $set.


Optimize your queries with many index types, for example, compound, multikey, wildcard, geospatial, and more - no matter how deeply nested the fields.

Transform and analyze

Create highly sophisticated real-time analytics against live data in the same database cluster, with no ETL or duplication.


Deploy advanced full-text search capabilities built for the MongoDB document model with no additional infrastructure to manage.

Change streams

Build real-time, event-driven applications that can react to any data changes in the database and automatically trigger server-side logic.

Join and union

Utilize the power of aggregation stages like $lookup and $unionWith to join and blend multiple collections for analytics and data exploration.


Put your application on the map and easily run queries against geospatial data.


Use operators like $graphLookup to quickly traverse connected data sets.

On-Demand materialized views

Pre-compute and cache common queries, dynamically updating result sets as new data is processed.

MongoDB Query API supports all major languages

MongoDB Query API University

Deep dive into the MongoDB Query API with our University course. Start it today!

Frequently Asked Questions

How is it different from SQL?

The MongoDB Query API is designed to work with rapidly changing data of any structure, where SQL is designed to access flat, tabular data structures.

Is this a new language I will have to learn?

Nope! We have language drivers that allow queries to be programmatically generated and tools for low code development of more complex aggregation pipelines.

What is the difference between MongoDB Query API and the aggregation pipeline?

The aggregation pipeline is part of the MongoDB Query API. The API supports CRUD operations against your data, and the aggregation pipeline is modeled on the concept of Unix pipes. Data flows through a series of composable aggregation pipeline stages where it is transformed and processed, allowing you to create sophisticated real-time analytics against your data in-place without having to move it out to specialized analytics databases.

What tools can I use to write queries?

You can use visual tools such as Compass Aggregation Pipeline Builder, Atlas Data Explorer, ODMs for programming language drivers, VS code extension, or 3rd party IDEs.

I am used to SQL. How does the MongoDB Query API map to it?

Check out our documentation page here to see the SQL to MongoDB mapping chart.

How can I learn to use MongoDB Query API?

Check out our in-depth documentation page or enroll in one of our MongoDB University Courses.