> For the complete documentation index, see [llms.txt](https://docs.bdb.ai/data-pipeline-4/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.bdb.ai/data-pipeline-4/components/readers/mongo-db-reader/mongodb-reader-lite-pymongo-reader.md).

# MongoDB Reader Lite (PyMongo Reader)

A **MongoDB** **reader** component is designed to read and access data stored in a MongoDB database. Mongo readers typically authenticate with MongoDB using a username and password or other authentication mechanisms supported by MongoDB.

This page covers the configuration steps for the Mongo DB Reader.All component configurations are classified broadly into the following sections:

* ​[​Basic Information​](/data-pipeline-4/components/component-base-configuration.md)​
* Meta Information
* [Resource Configuration​](/data-pipeline-4/components/resource-configuration.md)​
* ​[Connection Validation](https://docs.bdb.ai/7.6/data-pipeline/components/connection-validation)​

**MongoDB Reader** reads data from the specified database’s Collection. It also has an option to filter the data using Mongo Query Language(MQL), Which will run the MQL directly on the MongoDB Server, and push the data to the out event.

{% hint style="info" %}
*Check out the below-given walk through about the MongoDB Reader Lite.*
{% endhint %}

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fc39ZvXI46qjXzpN3rYAg%2Fuploads%2FlUellRquJnzyZuHLxLox%2Fmongo%20reader%20lite.mp4?alt=media&token=254d9136-272a-4e47-bcce-49a6ebcf57e7>" %}
Configuring MongoDB Reader Lite
{% endembed %}

## Accessing the Component Properties <a href="#accessing-the-component-properties" id="accessing-the-component-properties"></a>

* Drag & drop the ***Mongo Reader*** component to the ***Workflow Editor***.
* Click on the dragged reader component.
* The component properties tabs open below.

## **Basic Information**  <a href="#basic-information" id="basic-information"></a>

It is the default tab to open for the Mongodb Reader Lite while configuring the component.

* Select an ***Invocation Type*** from the drop-down menu to confirm the running mode of the reader component. Select ***Real-Time*** or ***Batch*** from the drop-down menu.​
* ***Deployment Type***: It displays the deployment type for the component (This field comes pre-selected).
* ***Container Image Version***: It displays the image version for the docker container (This field comes pre-selected).
* ***Failover Event:*** Select a failover Event from the drop-down menu.
* ***Batch Size (min 10):*** Provide the maximum number of records to be processed in one execution cycle (Min limit for this field is 10).

{% hint style="info" %} <mark style="color:green;">Please Note:</mark> *The* ***Grace Period Field** appears when the **Batch** is selected as the **Invocation Type** option in the **Basic Information** tab. You can now give a grace period for components to go down gracefully after that time by configuring this field.*&#x200B;
{% endhint %}

<figure><img src="/files/m3GgLX2TAXDyqIgSYciI" alt=""><figcaption></figcaption></figure>

<details>

<summary>Grace Period Field</summary>

The Grace Period field appears when the Batch option is selected as the Invocation Type. You can now give a grace period for components to go down gracefully after that time by configuring the given field in the Basic Information of the concerned component.

![](/files/M4Gjw8gOiXQ1Vicut69Q)

</details>

## Meta Information <a href="#meta-information" id="meta-information"></a>

Open the ***Meta Information tab*** and *fill in all the connection-specific details of* MongoDB Reader Lite. The ***Meta Information*** tab opens with the below given fields:&#x20;

<figure><img src="/files/dqrlSl6h01QcFZN7fJCJ" alt=""><figcaption><p>Meta Information tab with the basic fields.</p></figcaption></figure>

{% hint style="info" %}
*Please Note: The Meta Information fields may vary based on the selected **Connection Type** option.*
{% endhint %}

### Configuring the over all Meta Information tab fields <a href="#configuring-the-over-all-meta-information-tab-fields" id="configuring-the-over-all-meta-information-tab-fields"></a>

{% hint style="info" %}
*<mark style="color:green;">Please Note</mark><mark style="color:green;">**:**</mark> The fields marked as (\*) are mandatory fields.*
{% endhint %}

* ***Connection Type***: Select either of the options out of ***Standard**, **SRV**, and **Connection String***  as connection types.
* ***Port number*** (\*): Provide the Port number (*It appears only with the **Standard** connection type*).
* ***Host IP Address*** (\*): The IP address of the host.
* ***Username*** (\*): Provide a username.
* ***Password*** (\*): Provide a valid password to access the MongoDB.
* ***Database Name*** (\*): Provide the name of the database where you wish to write data.
* ***Collection Name*** (\*): Provide the name of the collection.
* ***Fetch size:*** Specifies the number of documents to return in each batch of the response from the MongoDB collection. For ex: If 1000 is given in the fetch size field. Then it will read the 1000 data at one execution and it will process it further.&#x20;
* ***Additional Parameters***: Provide details of the additional parameters.
* **Enable SSL:** Check this box to enable SSL for this components. MongoDB connection credentials will be different if this option is enabled.&#x20;

  The user needs to upload the following files on the certificate upload page:

  * **Certificate file (.pem format)]**
  * **Key file (.key format)**
* **Certificate Folder:** This option will appear when the Enable SSL field is checked-in. The user has to select the certificate folder from drop down which contains the files which has been uploaded to the admin settings for connecting MongoDB with SSL. Please refer the below given images for the reference.
* ***Connection String*** (\*): Provide a connection string (*It appears only with the **Connection String** connection type)*.
* ***Query***: Provide a relevant query service. We can write the Mongo queries in the following manner:

```mongodb
bi_testing.d1.find({ "$or": [ { "AmountSpent": "10255" } , { "Age": "Old" } ] })// Some codedb.collection_name.aggregate([{'$match': {'Goal1Adjective': 'High'}}])
```

### Variations in the Meta Information tab fields <a href="#variations-in-the-meta-information-tab-fields" id="variations-in-the-meta-information-tab-fields"></a>

* [x] Meta Information Tab with **Standard as the Connection Type**

<figure><img src="/files/aKLgl4vEUTgA6Wr0BHsX" alt=""><figcaption></figcaption></figure>

* [x] Meta Information Tab with **SRV as the Connection Type**

<figure><img src="/files/BVUlhiNBY2o7jTT5kxd7" alt=""><figcaption></figcaption></figure>

* [x] Meta Information Tab with **Connection String as the Connection Type**

<figure><img src="/files/AbmMqTQ00d5xrXKZ5JHq" alt=""><figcaption></figcaption></figure>

**Meta Information Tab with enabled the "Enable SSL" field:**

<figure><img src="/files/ljwC2OzwHfyU7nhs86cR" alt=""><figcaption></figcaption></figure>

## Saving the Reader Component

After configuring the required configuration fields, click the ***Save Component in Storage*** icon provided in the reader configuration panel to save the component.

<figure><img src="/files/dot3DCpa3Sy8qgQMnZtn" alt=""><figcaption></figcaption></figure>

* A confirmation message appears to notify the component properties are saved.

## Updating and Activating Pipeline <a href="#updating-and-activating-pipeline" id="updating-and-activating-pipeline"></a>

* Click on the ***Update Pipeline*** icon to update the pipeline.

<figure><img src="/files/iKaleFjDBSU3Fu95Lbc3" alt=""><figcaption></figcaption></figure>

* A confirmation message appears to inform the user.

<figure><img src="/files/bB72qzWNe57s3IuPcuU4" alt=""><figcaption></figcaption></figure>

* Click on the ***Activate Pipeline*** icon.​

<figure><img src="/files/UGZYzfOOgeacaDLNudjf" alt=""><figcaption></figcaption></figure>

* The Confirm dialog box appears to ask the user permission.
* Click the ***YES*** option.

<figure><img src="/files/tnT3kx4avhsUUYfu8Zj9" alt=""><figcaption></figcaption></figure>

* A confirmation message appears to inform that the pipeline has been activated.

<figure><img src="/files/0wEZlUooILrfwSFFIWVt" alt=""><figcaption></figcaption></figure>

## Accessing the Log Panel <a href="#accessing-the-log-panel" id="accessing-the-log-panel"></a>

* Click on the ***Toggle Log Panel*** icon.
* The ***Log Panel*** opens displaying the ***Logs*** and ***Advance Logs*** tabs.

![](https://859511478-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FGDmsjfjJBNqow7Fo97cO%2Fuploads%2FGWSWcQ7xN6i3jxJVi2qm%2Fimage.png?alt=media\&token=d8d576ca-8872-4401-8005-9ea36f4a6f80)​

***Please Note:***

* *The Pod logs for the components appears in the **Advanced Logs** tab.*
* *The overall component logs will be displayed in the **Logs** tab*.

## Tabs for a Configured Component <a href="#tabs-for-a-configured-component" id="tabs-for-a-configured-component"></a>

* A configured component will display some more tabs such as the ***Configuration***, ***Logs***, and ***Pod Logs*** tabs (as displayed below for the Mongodb Reader Lite component).

<figure><img src="/files/oRIXpYH8GGNoCZXdVBcN" alt=""><figcaption><p>Tabs for a configured PyMongo Reader</p></figcaption></figure>

### Configuration Tab

<figure><img src="/files/jkVyMqzfsQCY7nhPGGei" alt=""><figcaption></figcaption></figure>

### Logs Tab

<figure><img src="/files/8sNJn095Q9VTUtMeUjgJ" alt=""><figcaption></figcaption></figure>

### Pod Logs Tab

<figure><img src="/files/qi8omIFjJPHD69FizISU" alt=""><figcaption></figcaption></figure>

## Summary Tab

This tab will show all the description about the component.

<figure><img src="/files/Mbzx09lDviYHOASoLWBN" alt=""><figcaption><p>Summary tab for Mongodb Reader Lite</p></figcaption></figure>


---

# 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.bdb.ai/data-pipeline-4/components/readers/mongo-db-reader/mongodb-reader-lite-pymongo-reader.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.
