MongoDB

MongoDB is an open source NoSQL database management program.

Go to site
Explore
/
Apps
/
MongoDB

MongoDB API Integrations

Build and run workflows using the MongoDB API. Use 1000s of source-available triggers and actions across 2,400+ apps. Or write custom code to integrate any app or API in seconds.

Trusted by 1,000,000+ developers from startups to Fortune 500 companies

Adyen logo
Appcues logo
Bandwidth logo
Checkr logo
ChartMogul logo
Dataminr logo
Gopuff logo
Gorgias logo
LinkedIn logo
Logitech logo
Replicated logo
Rudderstack logo
SAS logo
Scale AI logo
Webflow logo
Warner Bros. logo
Adyen logo
Appcues logo
Bandwidth logo
Checkr logo
ChartMogul logo
Dataminr logo
Gopuff logo
Gorgias logo
LinkedIn logo
Logitech logo
Replicated logo
Rudderstack logo
SAS logo
Scale AI logo
Webflow logo
Warner Bros. logo

Overview

The MongoDB API provides powerful capabilities to interact with a MongoDB database, allowing you to perform CRUD (Create, Read, Update, Delete) operations, manage databases, and execute sophisticated queries. With Pipedream, you can harness these abilities to automate tasks, sync data across various apps, and react to events in real-time. It’s a combo that’s particularly potent for managing data workflows, syncing application states, or triggering actions based on changes to your data.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import mongodb from 'mongodb'

export default defineComponent({
  props: {
    mongodb: {
      type: "app",
      app: "mongodb",
    },
    collection: {
      type: "string"
    },
    filter: {
      type: "object"
    }
  },
  async run({steps, $}) {
    const MongoClient = mongodb.MongoClient
    
    const {
      database,
      hostname,
      username,
      password,
    } = this.mongodb.$auth
    
    const url = `mongodb+srv:https://${username}:${password}@${hostname}/test?retryWrites=true&w=majority`
    const client = await MongoClient.connect(url, { 
      useNewUrlParser: true, 
      useUnifiedTopology: true 
    })
    
    const db = client.db(database)

    const results = await db.collection(this.collection).find(this.filter).toArray();
    $.export('results', results);
    
    await client.close()
  },
})

Choose an API to Connect with MongoDB API

1
-
24
of
2,400+
apps by most popular

HTTP / Webhook
HTTP / Webhook
Get a unique URL where you can send HTTP or webhook requests
Node
Node
Anything you can do with Node.js, you can do in a Pipedream workflow. This includes using most of npm's 400,000+ packages.
Python
Python
Anything you can do in Python can be done in a Pipedream Workflow. This includes using any of the 350,000+ PyPi packages available in your Python powered workflows.
OpenAI (ChatGPT)
OpenAI (ChatGPT)
OpenAI is an AI research and deployment company with the mission to ensure that artificial general intelligence benefits all of humanity. They are the makers of popular models like ChatGPT, DALL-E, and Whisper.
Premium
Salesforce
Salesforce
Web services API for interacting with Salesforce
Premium
HubSpot
HubSpot
HubSpot's CRM platform contains the marketing, sales, service, operations, and website-building software you need to grow your business.
Premium
Zoho CRM
Zoho CRM
Zoho CRM is an online Sales CRM software that manages your sales, marketing, and support in one CRM platform.
Premium
Stripe
Stripe
Stripe powers online and in-person payment processing and financial solutions for businesses of all sizes.
Shopify
Shopify
Shopify is a complete commerce platform that lets anyone start, manage, and grow a business. You can use Shopify to build an online store, manage sales, market to customers, and accept payments in digital and physical locations.
Premium
WooCommerce
WooCommerce
WooCommerce is the open-source ecommerce platform for WordPress.
Premium
Snowflake
Snowflake
A data warehouse built for the cloud
Premium
MongoDB
MongoDB
MongoDB is an open source NoSQL database management program.
Supabase
Supabase
Supabase is an open source Firebase alternative.
MySQL
MySQL
MySQL is an open-source relational database management system.
PostgreSQL
PostgreSQL
PostgreSQL is a free and open-source relational database management system emphasizing extensibility and SQL compliance.
Premium
AWS
AWS
Amazon Web Services (AWS) offers reliable, scalable, and inexpensive cloud computing services.
Premium
Twilio SendGrid
Twilio SendGrid
Send marketing and transactional email through the Twilio SendGrid platform with the Email API, proprietary mail transfer agent, and infrastructure for scalable delivery.
Amazon SES
Amazon SES
Amazon SES is a cloud-based email service provider that can integrate into any application for high volume email automation
Premium
Klaviyo
Klaviyo
Email Marketing and SMS Marketing Platform
Premium
Zendesk
Zendesk
Zendesk is award-winning customer service software trusted by 200K+ customers. Make customers happy via text, mobile, phone, email, live chat, social media.
Notion
Notion
Notion is a new tool that blends your everyday work apps into one. It's the all-in-one workspace for you and your team.
Slack
Slack
Slack is a channel-based messaging platform. With Slack, people can work together more effectively, connect all their software tools and services, and find the information they need to do their best work — all within a secure, enterprise-grade environment.
Microsoft Teams
Microsoft Teams
Microsoft Teams has communities, events, chats, channels, meetings, storage, tasks, and calendars in one place.
Schedule
Schedule
Trigger workflows on an interval or cron schedule.

Example Use Cases

  • Real-time Data Syncing with Google Sheets: Sync new MongoDB document entries to a Google Sheet for easy sharing and reporting. Whenever a new customer is added to the MongoDB database, a Pipedream workflow triggers and appends the customer data to a Google Sheet, keeping your sales team updated in real-time.

  • Automated Backup Notifications via Email: Set up a daily database backup and use Pipedream to monitor the completion status of the backup operation. Once a backup is successfully completed, trigger an SMTP action to send an email notification to the system admin, ensuring peace of mind with regular backup status updates.

  • Slack Alerts for High-Value Transactions: Monitor your MongoDB for transactions exceeding a certain value and send alerts to a Slack channel when such transactions occur. Finance teams can stay on top of significant movements without manual database checks, improving response time and financial oversight.

Getting Started

To get started, you need to set up a user to connect to your MongoDB cluster. This guide assumes your MongoDB cluster is hosted on Mongo Atlas.

First, log in to Mongo Atlas to complete the next steps.

Create the MongoDB User

First, create a dedicated user for connecting MongoDB to Pipedream.

Select the MongoDB project where your cluster resides, then select the Database Access tab. Here, you'll see a list of users who can connect to your MongoDB cluster.

Click Create new database user to get started.

Open the MongoDB project from within MongoDB Atlas and select the Database Access panel, then create the user

In the new pop-up, choose the Password authentication method first. Name the user pipedream so it’s easy to remember which service this user account is used for.

Generate a password and select a pre-built or custom role. Pre-built roles offer options like read-only or read and write access to all databases in the cluster. For more fine-tuned control, like restricting Pipedream to reading a single database, use a custom role.

Finally click Add user to create this new user account.

Filling out the details of the new user account in MongoDB Atlas for connecting this new user to Pipedream

Provide the Credentials

Now, with a dedicated MongoDB user, connect to Pipedream. Return to Pipedream to set up a new MongoDB action in a workflow or to add your MongoDB account in the Connected Accounts area.

Copy and paste the Username and Password fields from the previous step, when you created the pipedream user in Mongo Atlas.

To find your database hostname, go to the Databases view in Mongo Atlas and click the Connect button for your chosen database.

Select the Compass or Node.js option. Then you’ll see the connection URI string. The hostname is the latter portion of the string, as shown below:

Finding the MongoDB database host name in MongoDB Atlas by using the Connect button to show the connection URI

Lastly, provide the Database name to connect to.

Allowing Pipedream Connections

By default, Pipedream workflows can start anywhere within the us-east-1 AWS IP range. You'll need to expose your MongoDB Atlas Cluster to the internet or use a Pipedream VPC to assign a specific outbound IP address to your workflows.

Allowing any IP Address Range

First, open the Network Access section of your MongoDB Atlas project. Then click Add new IP address in the top right-hand corner:

Add a new IP address to the allowed list of IP addresses within MongoDB Atlas

Then enter 0.0.0.0/0 in the IP address field to allow connections from any IP address. In the description field, we recommend adding a note about this requirement for Pipedream.

Allowing any IP address to connect to your MongoDB Atlas Database Cluster. Necessary for services like Pipedream workflows that don’t have a static IP address unless you’re using Pipedream VPCs.

Finally, click Confirm

Using a Pipedream VPC

Pipedream VPCs allow you to define a single static IP address for your workflows and allow you to run these workflows in a separate network.

Follow this guide to create a VPC and assign the IP address to your workflow.

Then create a new allowed IP address in MongoDB by opening the Network Access section in Atlas:

![Add a new IP address to the allowed list of IP addresses within MongoDB Atlas](https://res.cloudinary.com/pipedreamin/image/upload

Create a Customer with Stripe API on New Database from MongoDB API
MongoDB + Stripe
 
Try it
Upload File with Google Drive API on New Collection from MongoDB API
MongoDB + Google Drive
 
Try it
Create an Update with monday.com (API Key) API on New Database from MongoDB API
MongoDB + monday.com (API Key)
 
Try it
Archive Card with Trello API on New Collection from MongoDB API
MongoDB + Trello
 
Try it
Create a Page with Notion API on New Database from MongoDB API
MongoDB + Notion
 
Try it
New Collection from the MongoDB API

Emit new an event when a new collection is added to a database

 
Try it
New Database from the MongoDB API

Emit new an event when a new database is added

 
Try it
New Document from the MongoDB API

Emit new an event when a new document is added to a collection

 
Try it
New Field in Document from the MongoDB API

Emit new an event when a new field is added to a document

 
Try it
Create New Document with the MongoDB API

Create a new document in a collection of your choice. See the docs here

 
Try it
Delete a Document with the MongoDB API

Delete a single document by ID. See the docs here

 
Try it
Execute Aggregation with the MongoDB API

Execute an aggregation pipeline on a MongoDB collection. See the documentation

 
Try it
Find Document with the MongoDB API

Finds a document by a query filter. See the documentation

 
Try it
Find Document by Id with the MongoDB API

Retrieves a single document by ID. See the docs here

 
Try it

Authentication

Name Slug: mongodb

MongoDB uses API keys for authentication. When you connect your MongoDB account, Pipedream securely stores the keys so you can easily authenticate to MongoDB APIs in both code and no-code steps.

Before you connect to your Mongo database from Pipedream, please make sure your database is accessible from the public internet. You may need to add a firewall rule allowing connections from 0.0.0.0/0.

Then, enter the details of your Mongo host / database below.

Trusted by 1,000,000+ developers from startups to Fortune 500 companies

Adyen logo
Appcues logo
Bandwidth logo
Checkr logo
ChartMogul logo
Dataminr logo
Gopuff logo
Gorgias logo
LinkedIn logo
Logitech logo
Replicated logo
Rudderstack logo
SAS logo
Scale AI logo
Webflow logo
Warner Bros. logo
Adyen logo
Appcues logo
Bandwidth logo
Checkr logo
ChartMogul logo
Dataminr logo
Gopuff logo
Gorgias logo
LinkedIn logo
Logitech logo
Replicated logo
Rudderstack logo
SAS logo
Scale AI logo
Webflow logo
Warner Bros. logo