MongoDB Module Overview
  • 16 Dec 2024
  • 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.

The MongoDB Module must be installed to be able to configure it. To learn how to install a module navigate here.
  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.
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.
Delete DocumentDeletes one document by ID


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



Was this article helpful?