ANNOUNCEMENTVoyage AI joins MongoDB to power more accurate and trustworthy AI applications on Atlas. Learn more >
NEWSLearn why MongoDB was named a leader in the 2024 Gartner® Magic Quadrant™ Read the report >
NEWMongoDB 8.0: Experience unmatched speed and performance. Check it out >

MongoDB as the Open Finance Data Store

MongoDB powers open finance with flexible data integration, built-in security, and scalability—enabling seamless, compliant, and personalized financial services.
Start Free
An illustration of currency and real-time analytics representing MongoDB's usage in the financial services industry.
Solutions Overview

Open finance is transforming the financial industry, enabling seamless data sharing across banks, fintech companies, and third-party providers. However, integrating diverse financial data while ensuring security, compliance, and scalability is a major challenge.

MongoDB provides the ideal foundation for open finance with its flexible document model, native JSON support, and powerful aggregation framework—allowing institutions to unify data from multiple sources effortlessly. With built-in encryption, fine-grained access controls, and high availability, MongoDB ensures secure and compliant data management.

By leveraging MongoDB, financial institutions can accelerate innovation, offer personalized financial insights, and seamlessly adapt to evolving regulations—all without the complexity of traditional relational databases.

An illustration demonstrating the process of reference architecture.
Ref Architecture

At the center of this architecture is our fictional demo bank, Leafy Bank, which allows users to connect external bank accounts securely.

First, the user initiates a request to connect their external bank accounts. This requires explicit user consent, ensuring security and compliance with regulations like PSD2. To authenticate, Leafy Bank emulates OAuth 2.0, generating Bearer tokens for secure communication between institutions.

Once authorized, Leafy Bank communicates with external banks—like Green Bank or MongoDB Bank—via APIs. These banks expose financial data such as accounts, transactions, and balances through their microservices. The response is returned in JSON format, ensuring compatibility and seamless data exchange.

The retrieved financial data is then pushed into MongoDB Atlas, where it is centrally stored. MongoDB’s flexible document model makes it easy to handle diverse data structures from different banks. From here, Leafy Bank can leverage MongoDB Aggregation Pipelines to analyze and enrich the data, giving users a holistic financial view while enabling the bank to offer personalized financial insights.

Open Finance Architecture with Leafy Bank
Open Finance Architecture with Leafy Bank
Data Model Approach

In the demo solution for open finance using MongoDB as the central data store, the data model is a simplified design that emulates real-world financial data integration. The approach leverages MongoDB's flexible document model to handle diverse data structures from different financial entities. Here’s a detailed description of the data model approach:

Simplified components for demonstration purposes

  • Tokens collection:
    • Purpose: Stores Bearer tokens used for authenticating and authorizing API requests between Leafy Bank and external banks.
    • Structure:
  • Simplification: In a real-world scenario, token management would involve more complex mechanisms, including token expiration, refresh tokens, and secure storage practices.
  • External accounts collection:

    • Purpose: Stores information about external bank accounts linked by users.
    • Structure:

  • Simplification: Real-world account data would include more detailed information such as transaction history, account limits, and additional metadata for compliance and auditing.
  • External products collection:

    • Purpose: Stores information about financial products (e.g., loans and mortgages) associated with users.
    • Structure:

  • Simplification: In a real-world scenario, product data would be more comprehensive, including detailed terms and conditions, repayment schedules, and collateral details.
  • Real-world scenario considerations

In a real-world implementation, each financial entity would have its own data model definitions, which could vary significantly. The following considerations would be essential:

  • Data mapping and relationships:
    • Implementing a robust data mapping and relationship layer to translate diverse data models from different financial entities into a unified format.
  • Security and compliance:
    • Ensuring data security and compliance with regulations such as GDPR, PSD2, and other local financial regulations. This includes encryption, access controls, and audit trails.
  • Scalability and performance:
    • Designing the data model to handle large volumes of data efficiently, with considerations for indexing, sharding, and performance optimization.
  • Integration and interoperability:
    • Building APIs and microservices that can seamlessly integrate with various external systems, ensuring interoperability and real-time data exchange.

By using MongoDB's flexible document model, the demo solution effectively showcases how financial institutions can unify and manage diverse data sources. However, a production-grade implementation would require addressing the complexities and nuances of real-world financial data integration.

Building the Solution

For detailed setup instructions you can follow the steps outlined in our public GitHub repository. This repository hosts the backend for Leafy Bank's open finance demo service. It demonstrates integration with third-party banks and showcases secure data exchange. MongoDB serves as the central data store. This code may include simplified or emulated components for demonstration purposes.

How to build the solution step-by step:

Step 1: Set up MongoDB database and collections

Create a new database in MongoDB Atlas named open_finance, then add three collections: tokens, external_accounts, and external_products. Import the provided sample data.

Step 2: Add MongoDB user

Create a new user with readWrite access to the open_finance database to manage data securely.

Step 3: Configure environment variables

Add the necessary database credentials and API origins to a .env file for seamless connectivity.

Step 4: Run it locally

Set up a virtual environment using Poetry, install dependencies, and start the backend with uvicorn. Ensure the service runs on the correct port for API communication.

Frontend for this solution

The frontend for this solution is available in the Leafy Bank UI repository. The different components of Leafy Bank are designed as microservices, with the UI repository serving as the main hub, providing an overview of all integrated services.

Key learnings
  • MongoDB can serve as the backbone of an open finance ecosystem by acting as a flexible and efficient central data store
  • With built-in encryption, access controls, and high availability, MongoDB ensures secure data management while meeting evolving regulatory requirements.
Technologies and Products Used
  • MongoDB Atlas
  • Aggregation Pipeline
Authors
  • Luis Pazmino Diaz, MongoDB
  • Ainhoa Mugica, MongoDB
  • Julian Boronat, MongoDB
  • Andrea Alaman Calderon, MongoDB
Related Resources
general_content_blog

Embracing Open Finance Innovation with MongoDB

Discover how MongoDB accelerates open finance integration, enhancing data sharing, security, and regulatory compliance.

general_action_develop

Github Repository: Open Finance

Create this demo for yourself by following the instructions in this solution’s repository.

MongoDB for Financial Services

Build AI-powered customer experiences at lower cost and at scale by unifying both structured and unstructured data with vector data.
Learn more
An illustration of currency and real-time analytics representing MongoDB's usage in the financial services industry.