This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Download Microsoft Edge
More info about Internet Explorer and Microsoft Edge
Logic Apps
Standard
All
Logic Apps regions
except the following:
- Azure Government regions
- Azure China regions
- US Department of Defense (DoD)
Power Automate
Premium
All
Power Automate regions
except the following:
- US Government (GCC)
- US Government (GCC High)
- China Cloud operated by 21Vianet
- US Department of Defense (DoD)
Power Apps
Not available
MongoDB Connector provides a simple way to connect to MongoDB Atlas via Atlas Data API to read and write data to MongoDB Atlas collections. MongoDB connector makes it easy to perform CRUD operations and aggregations on your data in minutes and allows you to query MongoDB to build rich apps and workflows in Power Apps and Power Automate.
Prerequisites
Configure Atlas Environment
Register for a new Atlas Account
here
. Follow steps from 1 to 4 (Create an Atlas account, Deploy a Free cluster, Add your IP to the IP access list and Create a Database user) to set up the Atlas environment.
Enable the Data API in Atlas
here
.
Under Data API Access dropdown, choose
Read And Write
option.
Save the URL endpoint which will be used at a later stage.
Create a Data API Key
here
Note: Save the api key generated as this is the only time you can retrieve the full private key.
How to get credentials
Follow the steps in
Create a Data API Key
to create API key in Atlas and use it in the API calls
Get started with your connector
Once the Prerequisites are completed, Go to PowerAutomate-> Data-> Connections. Click on "New Connection" and search for MongoDB in the right Search Bar like shown below in the screenshot.
Click on the MongoDB connection and you would see the below popup which asks to enter the API key and the Base URL.
1: For the "API Key" field, enter the Data API key which you would have set up in the
Step 3
2: For the "BaseUrl", enter the URL Endpoint you find in the MongoDB Atlas portal->
Data API
.
Use one of the Data APIs for any CRUD operations against MongoDB Atlas. For complex queries, use the "Run an Aggregation Pipeline" API to use aggregation stages to massage the output from one stage to another. The flexibility and dynamism of MongoDB allows you to create rich apps and automate any time consuming processes. You keep enhancing the apps by adding more features and fields to the same collection.
Additionally, check
Appsource
for a hands-on demo of a Banking Customer Onboarding application built using Power Apps, Power Automate and MongoDB Atlas. The Github link for the same is
here.
Known issues and limitations
As MongoDB does not enforce a schema, the current connector can be used with Power Automate and Logic Apps only, which supports dynamic schema for the API response, which can then be parsed using the "Parse JSON" constructs. It can be used in Power Apps by invoking a Power Automate flow for every MongoDB interaction. You can also continue to use the certified MongoDB connector from the
Microsoft Github repository
as a Custom connector to use it in Power Apps directly to customize the Response schema as per your MongoDB collection schema.
Restrictions applicable to MongoDB Data API does apply to the MongoDB connector also. Please refer to this
link
to know more about the aggregation stages that are not supported under User context of Data APIs.
Please follow this
link
for the known limitations with the requests
Common errors and remedies
Please follow this
link
for common error codes and this
link
for known failure due to request traffic limitations
Creating a connection
The connector supports the following authentication types:
You can use the updateOne endpoint to update a single record. Use the filter property in the request body to specify the search criteria. If more than one document matches the criteria, only the first match will be returned. Then use the update field to specify what should be updated. You should use one of the update operators to update your documents.
To delete a single document, use the deleteOne endpoint. Use the filter property in the request body to specify the search criteria. If more than one document matches the criteria, only the first match will be deleted.
Parameters
Required
Description
MongoDB Cluster Name
dataSource
string
The name of the cluster.
You can use deleteMany to delete multiple documents at once. Use the filter property to specify which documents to delete. Beware that using this API without any filters will delete all the documents in the collection. Use deletemany with care.
Parameters
Required
Description
MongoDB Cluster Name
dataSource
string
The name of the cluster.
Using the findOne endpoint will let you retrieve a single document from a collection. Use the filter property in the request body to specify the search criteria. If more than one document matches the criteria, only the first match will be returned.
Parameters
Required
Description
MongoDB Cluster Name
dataSource
string
The name of the cluster.
Using the find endpoint, you can fetch multiple documents at once. Use the filter property in the body of the request to specify the criteria on which to filter. If you pass an empty object, all the documents in the collection will be returned.
Parameters
Required
Description
MongoDB Cluster Name
dataSource
string
The name of the cluster.
Using the insertOne endpoint, you can add a document to a collection. Use the document property in the request body to specify the document that should be created.
Parameters
Required
Description
MongoDB Cluster Name
dataSource
string
The name of the cluster.
You can add more than one document at a time by using the insertMany endpoint. In that case, you must use the documents property in the body of the request to specify the array of documents you want to insert into the collection.
Parameters
Required
Description
MongoDB Cluster Name
dataSource
string
The name of the cluster.
You can even run aggregation pipelines with the Data API. To do so, use the aggregate endpoint and specify your pipeline in the pipeline field of the request body.
Parameters
Required
Description
MongoDB Cluster Name
dataSource
string
The name of the cluster.
You can use the updateOne endpoint to update a single record. Use the filter property in the request body to specify the search criteria. If more than one document matches the criteria, only the first match will be returned. Then use the update field to specify what should be updated. You should use one of the update operators to update your documents.
Parameters
Required
Description
MongoDB Cluster Name
dataSource
string
The name of the cluster.
Using updateMany, you can update all the documents matching a specific filter specified in the body of the request. Use one of the update operators in the update field to update your documents.
Parameters
Required
Description
MongoDB Cluster Name
dataSource
string
The name of the cluster.