21
Views
0
Comments
How to run MongoDB aggregation pipelines with Integration Builder

Integration Builder allows developers to create MongoDB integrations in a matter of minutes by providing server actions that perform CRUD operations on database collections.

However, you may notice that MongoDB integrations generated by Integration Builder don't expose any action to run aggregation pipelines. Fortunately, there is an easy workaround that will enable the developer to take advantage of aggregation pipelines, which is through the use of Views.

I'll explain how:

  1. Connect to your MongoDB database using your preferred client (I'm using MongoDB Compass in this example) and build your aggregation pipeline
  2. Create a View from that pipeline
  3. In Integration Builder, add the newly created View to your MongoDB integration and publish it
  4. Once published, you can consume the Search<View name>Documents action from the generated module in your own app and display the results on the screen

I believe this approach should cover most of the use cases while taking advantage of Integration Builder.

What do you think? Let me know if you have any use case that is not covered by this approach.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.