> For the complete documentation index, see [llms.txt](https://docs.pentaho.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pentaho.com/pdia-data-integration/9.3-data-integration/pdi-transformation-steps-reference-overview/mongodb-input/options-mongodb-input/query-tab.md).

# Query tab

![MongoDB Input Query tab](/files/LLT7rYdKHWAbwVsIZCud)

Use the **Query** tab to refine read requests. This tab operates in two different query modes:

* **Query expression** mode (default)
* **Aggregation pipeline specification** mode.

The **Query is aggregation pipeline** option toggles between these two modes. The **Query expression** uses MongoDB’s JSON-like query language with [query operators](https://docs.mongodb.com/manual/reference/operator/query/) to perform query operations. The **Aggregation pipeline specification** field uses MongoDB’s [aggregation framework](http://docs.mongodb.org/manual/applications/aggregation/) to transform and combine documents in a collection. An aggregation pipeline connects several [pipeline expressions](https://docs.mongodb.com/manual/core/aggregation-pipeline/#pipeline-expressions) together, with the output of the previous expression becoming the input for the next.

Enter the following information in the **Query** fields:

| Fields/Option                                 | Definition                                                                                                                                                                                                                                                                                                                                        |
| --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Query expression (JSON)**                   | Enter a query expression in this field to limit the output.                                                                                                                                                                                                                                                                                       |
| **Aggregation pipeline specification (JSON)** | Select the **Query is aggregation pipeline** option to display the **Aggregation pipeline specification (JSON)** field. Then enter a pipeline expression to perform aggregations or selections. The method name, including the collection name of the database you selected in the **Input Options** tab, appears after the label for this field. |
| **Query is aggregation pipeline**             | Select this option to use the aggregation pipeline framework.                                                                                                                                                                                                                                                                                     |
| **Allow disk use**                            | Select this option to turn on the **allowDiskUse** property so that you can process aggregation pipeline data when it exceeds the standard 100MB RAM allocation.                                                                                                                                                                                  |
| **Execute for each row**                      | Select this option to perform the query on each row of data.                                                                                                                                                                                                                                                                                      |
| **Fields expression (JSON)**                  | Enter an argument to control the projection (fields to return) from a query. If empty, all fields are returned. This field is only available for query expressions.                                                                                                                                                                               |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.pentaho.com/pdia-data-integration/9.3-data-integration/pdi-transformation-steps-reference-overview/mongodb-input/options-mongodb-input/query-tab.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
