---
title: "MongoDB Module Overview"
slug: "mongodb"
description: "This document shows how to configure steps for reading and writing from a MongoDB database to automatically deserialize and serialize from a selected data type via the MongoDB module. The document provides a tutorial, to step users through this process. "
updated: 2025-01-31T14:17:35Z
published: 2025-01-31T14:17:35Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://documentation.decisions.com/llms.txt
> Use this file to discover all available pages before exploring further.

# MongoDB Module Overview

## Overview

The **MongoDB Module** allows a user to configure steps to read and write from a MongoDB database, automatically deserializing to and serializing from a chosen data type.

## Example

Prerequisites The following is required before the MongoDB Module may be properly used: 

- A preexisting MongoDB Account.
- Proper installation and set up of the MongoDB Module in Decisions.
- Create a [Project Dependency](https://documentation.decisions.com/docs/project-dependencies).  
  
For more information on how to install Modules in Decisions, see: [Installing Modules.](https://documentation.decisions.com/v9/docs/installing-modules-decisions)

This example will demonstrate how to set up the MongoDB Module in Decisions.

1. Navigate to any folder and select Create DataTypes/Integration go to Database Integration and select Add MongoDB Server at the bottom of the list.![](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/mongodbv98-1-24.png)
2. Enter a name for the Entity and check the checkboxes for **Get Connection String from Flow**, **Get Database Name from Flow**, **Get Collection Name from Flow**, and **Choose Document Type on Step** under SETTINGS. Then, click OK.![](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/Screenshot%202024-08-01%20165006.png)

Below are the settings configuration options for the MongoDB server in the **Entity dialog**window.

- **Get Connection String from Flow**: This is for the connection string to connect to the MongoDB server. If set to true the value needs to be determined at runtime as a step input.
- **Get Database Name from Flow**: The database name to use. If set to true this value needs to be determined at runtime.
- **Get Collection Name from Flow**: The collection name to use. If set to true this value needs to be determined at runtime.
- **Choose Document Type on Step**: The document type to serialize/deserialize while writing to and reading from MongoDB. If only working with a single document type, it can be specified here. Otherwise, check this checkbox to be able to set this at runtime.

These settings can be changed at any time by right-clicking on the MongoDB entity and selecting Edit.

![](https://cdn.document360.io/6ef8bcc1-6489-4486-9ad1-83acff7e5df0/Images/Documentation/image-1722545861118.png)

#### Available Steps

The following steps will be available in the Flow Designer Steps panel **Integration > MongoDB** under the name given when creating the connection.

| Steps | Description |
| --- | --- |
| [Get Document By ID](https://documentation.decisions.com/step-library/docs/get-document-by-id) | Fetches a single document by ID. |
| [Fetch Documents](https://documentation.decisions.com/step-library/docs/fetch-documents) | Fetches a list of documents based on the specified filters. Allows users to filter based on a field in the document, a field in a nested document, or by combining these filters with AND/OR. |
| [Insert Document](https://documentation.decisions.com/step-library/docs/insert-document) | Inserts the given document. If the chosen document type has an Id property and a value is specified, that property will be used for the new document. Otherwise, the Id property will be updated to contain the new ID after insertion. |
| [Insert Documents](https://documentation.decisions.com/step-library/docs/insert-documents) | This step enables Users to insert a list of items into a MongoDB Database. |
| [Replace Document](https://documentation.decisions.com/step-library/docs/replace-document) | Entirely replaces one document with another by ID. If the chosen document type has an Id property, its value must match the value of the Document ID input. |
| [Replace Documents](https://documentation.decisions.com/step-library/docs/replace-documents) | This step replaces a list of documents with another list of documents. |
| [Delete Document](https://documentation.decisions.com/step-library/docs/delete-document) | Deletes one document by ID. |
| [Delete Documents](https://documentation.decisions.com/step-library/docs/delete-documents) | This step enables Users to delete a list of items from a MongoDB Database. |

There are also steps to manage collections and databases under **Integration > MongoDB > Advanced**.

| Steps | Description |
| --- | --- |
| [Drop Collection](https://documentation.decisions.com/step-library/docs/drop-collection-advanced) | Removes a collection by name. |
| [Drop Database](https://documentation.decisions.com/step-library/docs/drop-database-advanced) | Removes a database by name. |
| [Get Collection Stats](https://documentation.decisions.com/step-library/docs/get-collection-stats-advanced) | Retrieves a list of statistics/properties from a specified collection. |
| [Get Database Stats](https://documentation.decisions.com/step-library/docs/get-database-stats-advanced) | Retrieves a list of statistics/properties from a specified database. |
| [List Collection Names](https://documentation.decisions.com/step-library/docs/list-collection-names-advanced) | Returns a list containing the names of all collections in the specified database. |
| [List Database Names](https://documentation.decisions.com/step-library/docs/list-database-names-advanced) | Returns a list containing the names of all databases on the specified MongoDB server. |
| [Rename Collection](https://documentation.decisions.com/step-library/docs/rename-collection-advanced) | Renames the specified collection within the chosen database. |
