MongoDB

The MongoDB piece in ZBrain Flow provides integration with MongoDB's document database, allowing you to interact with collections and documents directly from your workflows. This powerful connector enables you to create, read, update, and delete documents without manual intervention. With MongoDB integration, you can build automations that store structured data, retrieve information based on queries, maintain document collections, and synchronize information between your database and other business systems. This piece is ideal for organizations looking to incorporate NoSQL database operations into their automated processes, enabling flexible data storage and retrieval patterns for a wide range of applications.

How to Use MongoDB in ZBrain Flow

Select MongoDB as Your Connection

  • Click on the '+' button in the Flow and search for MongoDB.

  • Select MongoDB.

  • Decide on the action you need, then select it. ZBrain Flow provides several options:

    • Create Item – Add new documents to your MongoDB collections.

    • List All Items – Retrieve multiple documents from a collection.

    • Update Item – Modify existing documents by their ID.

    • Get Item by ID – Retrieve a specific document using its identifier.

    • Delete Item – Remove documents from your collections using their ID.

How to Connect to Your MongoDB Database

Before using any MongoDB actions in ZBrain Flow, you'll need to set up a connection to your MongoDB instance. This is a one-time setup that will allow you to access your database securely.

To create your MongoDB connection:

  • From any MongoDB action, click on the connection dropdown and select 'Create connection'.

  • In the popup window that appears, you'll need to:

    • Enter a descriptive 'Connection Name' to identify this MongoDB connection

    • In the 'MongoDB URI' field, enter your connection string

    • In the 'Database Name' field, enter the name of the specific database you want to access

    • In the 'Collection Name' field, enter the name of the collection within that database

    • Click 'Save' to store this connection

To obtain your MongoDB connection URI:

  1. Log in to your MongoDB Atlas account (or your self-hosted MongoDB admin interface)

  2. Navigate to your cluster's connection settings

  3. Select "Connect your application" and copy the connection string

  4. Replace <username>, <password>, and <cluster> with your actual credentials

How to Add New Documents to MongoDB

Configuration Steps:

  • Connect to your MongoDB instance following the steps in the "How to Connect to Your MongoDB Database" section.

  • In the 'Item' field, enter a JSON object representing the document you want to create. For example: Your document can include nested objects, arrays, and various data types.

How to List MongoDB Items

To list all MongoDB items, simply connect to your MongoDB instance following the steps in the "How to Connect to Your MongoDB Database" section.

How to Update Existing MongoDB Documents

Configuration Steps:

  • Connect to your MongoDB instance following the steps in the "How to Connect to Your MongoDB Database" section.

  • In the 'Item ID' field, enter the unique identifier (_id) of the document you want to update.

  • In the 'Item' field, enter a JSON object containing the fields and values you want to update.

How to Retrieve a MongoDB Document by ID

Configuration Steps:

  • Connect to your MongoDB instance following the steps in the "How to Connect to Your MongoDB Database" section.

  • In the 'Item ID' field, enter the unique identifier (_id) of the document you want to retrieve.

How to Remove Documents from MongoDB Collections

Configuration Steps:

  • Connect to your MongoDB instance following the steps in the "How to Connect to Your MongoDB Database" section.

  • In the 'Item ID' field, enter the unique identifier (_id) of the document you want to delete.

Last updated