Skip to content
Agencei

Expertise

MongoDB expertise: modelling and operating a document database

MongoDB is the most widely used document database. It stores flexible-schema BSON documents, offers rich indexes, a powerful aggregation pipeline, multi-document transactions and horizontal scaling through sharding. MongoDB Atlas adds managed hosting, full-text search and vector search.

Agencei uses MongoDB when the data model is genuinely document-oriented: catalogues with variable attributes, event logs, user profiles, content, data from third-party APIs. We pair it mostly with Node.js and NestJS, and we audit existing databases whose performance is degrading.

This expertise is for teams building a product with an evolving schema, or already running MongoDB and facing slowness, cost or consistency issues.

Use cases

SaaS backend with Node.js

Per-tenant documents, schemas validated on both the application and database side, and compound indexes for the main screens' queries.

Catalogues with variable attributes

Products, equipment or assets whose characteristics differ from one category to another, without multiplying join tables.

Logging and events

High-volume event collections with TTL indexes, time series collections and aggregations for dashboards.

Content and semi-structured data

Dynamic forms, partner API responses and business documents stored as-is, then queried through indexes.

Audit and optimisation of an existing database

Review of the model, unnecessary or missing indexes, collection-scanning queries and cluster sizing.

Project types

  • Database for a Node.js application
  • Flexible-schema SaaS backend
  • Product or equipment catalogue
  • Event and log storage
  • MongoDB performance audit
  • Migration to or from MongoDB
  • Vector search with Atlas

Integration with the rest of the stack

  • MongoDB + Node.js (Mongoose, native driver)

    Mongoose schemas or database-side JSON Schema validation, TypeScript typing of documents and integration tests on a containerised instance.

  • MongoDB + Atlas on AWS

    Managed cluster in your application's AWS region, network peering, continuous backups and alerts on load metrics.

  • MongoDB + Docker and Kubernetes

    Containerised instance for development and testing, or a Kubernetes operator when self-hosting is required.

  • MongoDB + PostgreSQL

    Mixed architecture: transactional data in PostgreSQL, large or variable documents in MongoDB, synchronised through events.

Examples of problems solved

Queries scanning the whole collection (COLLSCAN)

Execution plan analysis, creation of compound indexes following the ESR rule and removal of redundant indexes that slow down writes.

Documents exceeding the size limit

Model redesign: unbounded arrays moved to a dedicated collection with references and the bucket pattern for series.

Slow aggregation for a dashboard

Reordering stages to filter early, covering indexes, precomputation in a materialised collection refreshed periodically.

Inconsistencies between collections

Using multi-document transactions where necessary, or remodelling to group what must be updated together.

Rising Atlas costs

Reducing index and document sizes, archiving cold data, adjusting the tier and removing orphaned collections.

Frequently asked questions

When should we choose MongoDB over PostgreSQL?

When the data really consists of documents with a variable structure, reads mostly fetch whole documents and the team works in JavaScript or TypeScript. For strongly relational data, PostgreSQL remains preferable.

Does MongoDB support transactions?

Yes, multi-document transactions have existed since MongoDB 4.0 on replica sets. They have a cost and should remain the exception; a good document model limits the need for them.

Atlas or self-hosting?

Atlas greatly simplifies operations: backups, upgrades, monitoring and scaling. Self-hosting is justified by sovereignty constraints or cost at very large volumes.

How do you secure MongoDB?

Mandatory authentication, least-privilege roles, encryption in transit and at rest, private networking with no public exposure and access auditing.

Can you migrate from MongoDB to a relational database?

Yes. We design the target schema, write idempotent transformation scripts and use dual writes or synchronisation to cut over without data loss.

Tell us about your project

Describe your need in a few lines: we come back to you with a first analysis and the next steps.