# Mongo ChangeStream

The **Mongo ChangeStream** component enables applications to subscribe to **real-time data changes** in MongoDB collections, databases, or entire deployments.

By leveraging MongoDB’s **change streams API**, this component allows pipelines to:

* Detect **insert, update, delete, and replace operations** immediately.
* React to data changes without the complexity of polling.
* Filter for specific operations using the aggregation framework.

This makes it especially useful for **event-driven architectures**, **real-time analytics**, and **reactive applications**.

### Configuration Sections

All configurations are classified into the following sections:

* **Basic Information**
* **Meta Information**
* **Resource Configuration**
* **Connection Validation**

### Basic Information Tab

The *Basic Information* tab defines general component properties.

| Field                       | Description                                                               | Required |
| --------------------------- | ------------------------------------------------------------------------- | -------- |
| **Invocation Type**         | Select execution mode: **Batch** or **Real-Time**.                        | Yes      |
| **Deployment Type**         | Displays the deployment type of the component (pre-selected).             | Yes      |
| **Container Image Version** | Displays the Docker image version used (pre-selected).                    | Yes      |
| **Failover Event**          | Select an event to handle errors or retries.                              | Optional |
| **Batch Size**              | Maximum number of records processed in one execution cycle (minimum: 10). | Yes      |

### Meta Information Tab

The *Meta Information* tab defines MongoDB connection settings and change stream configuration.

| Field                  | Description                                                                                                                                   | Required    |
| ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
| **Connection Type**    | Select the type of connection (Standard, SRV, or Connection String) and provide the necessary credentials.                                    | Yes         |
| **Database Name**      | Name of the database to monitor.                                                                                                              | Yes         |
| **Collection Name**    | Name of the collection within the database to monitor.                                                                                        | Yes         |
| **Operation Type**     | Select the operation to capture: **Insert**, **Update**, **Delete**, or **Replace**.                                                          | Yes         |
| **Enable SSL**         | Check to enable SSL for secure MongoDB connections. Requires separate credentials.                                                            | Optional    |
| **Certificate Folder** | Available only when *Enable SSL* is checked. Select a certificate folder from the dropdown (certificates must be uploaded in Admin Settings). | Conditional |

### Saving the Configuration

1. Configure all required **Basic Information** and **Meta Information** fields.
2. Click **Save Component** (Storage icon).
3. Activate the pipeline.
4. Perform an operation (**insert, update, delete, or replace**) in the MongoDB collection.
5. The **Mongo ChangeStream** component captures the change and sends it to the next event in the pipeline workflow.

### Example Workflow

1. Configure Mongo ChangeStream with:
   * **Database Name**: `sales_db`
   * **Collection Name**: `orders`
   * **Operation Type**: `Insert`
2. Save and activate the pipeline.
3. When a new order is inserted into the `orders` collection, the change stream captures it.
4. The pipeline processes the new order event in real time, updating dashboards or triggering notifications.


---

# Agent Instructions: 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:

```
GET https://docs.bdb.ai/bdb-user-documentation/platform-modules/11.0/data-engineering/data-pipelines/pipeline-editor/pipeline-components/consumers/mongo-changestream.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
