MongoDB Module Overview
  • 08 Jan 2025
  • 2 Minutes to read
  • Dark
    Light

MongoDB Module Overview

  • Dark
    Light

Article summary

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.

    For more information on how to install Modules in Decisions, see: Installing Modules.

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

  1. Navigate to System > Integrations. Right-click on MongoDB and select Add MongoDB Server.
  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.


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.


Available Steps

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

StepsDescription
Get Document By IDFetches a single document by ID.
Fetch DocumentsFetches 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 DocumentInserts 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 DocumentsThis step enables Users to insert a list of items into a MongoDB Database and is available in v8.16+. 
Replace DocumentEntirely 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 DocumentsThis step replaces a list of documents with another list of documents and is available in v8.16+.
Delete DocumentDeletes one document by ID.
Delete DocumentsThis step enables Users to delete a list of items from a MongoDB Database and is available in v8.16. 


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

StepsDescription
Drop CollectionRemoves a collection by name.
Drop DatabaseRemoves a database by name.
List Collection NamesReturns a list containing the names of all collections in the specified database.
List Database NamesReturns a list containing the names of all databases on the specified MongoDB server.
Rename CollectionRenames the specified collection within the chosen database.

Feature Changes

DescriptionVersionRelease DateDeveloper Task
Two new steps were added to the MongoDB Module: Insert Documents and Delete Documents. 8.16November 7, 2023[DT-038894]
The Replace Documents step was added to enable Users to replace a list of documents. 8.16November 7, 2023[DT-039340]



Was this article helpful?