MongoDB Module Overview
- 01 Aug 2024
- 2 Minutes to read
- Print
- DarkLight
MongoDB Module Overview
- Updated on 01 Aug 2024
- 2 Minutes to read
- Print
- DarkLight
Article summary
Did you find this summary helpful?
Thank you for your feedback
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.
- Dependency created to the Project.
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.
- Navigate to any folder and select Create DataTypes/Integration go to Database Integration and select Add MongoDB Server at the bottom of the list.
- 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.
These settings can be changed at any time by right-clicking on the MongoDB entity and selecting Edit.
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 | Fetches a single document by ID |
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 | 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. |
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. |
Delete Document | Deletes one document by ID |
There are also steps to manage collections and databases under Integration > MongoDB > Advanced.
Steps | Description |
---|---|
Drop Collection | Removes a collection by name. |
Drop Database | Removes a database by name |
List Collection Names | Returns a list containing the names of all collections in the specified database |
List Database Names | Returns a list containing the names of all databases on the specified MongoDB server |
Rename Collection | Renames the specified collection within the chosen database |
Was this article helpful?