Skip to main content

What are you looking for?

Explore our services and discover how we can help you achieve your goals

MongoDB: the document model for data that changes shape

MongoDB, the document database, fits data whose shape changes often or nests naturally — a product catalogue with different attributes per category, content with optional fields, or an events and logs stream — stored as JSON-like documents instead of rows spread across many joined tables.

Submit a project See the cloud ERP record

Reviewed by Huy Nguyen (David), CEO · Updated 17 Oct 2026

star

OutsourcingVN is operated by Netbase JSC, and this page keeps that document-shape decision separate from the relational default most transactional records still fit best.

Image

When does MongoDB fit, and when does it not?

Good fit

  • A catalogue, content set or event stream whose fields vary by item or change over time
  • A document that is naturally one self-contained record, read and written as a whole
  • High write volume on an event or log stream where documents rarely need cross-document consistency
  • A product still discovering its data shape, where a rigid schema would be redesigned every sprint

Another route fits better

  • Accounts, orders or ledgers that must stay strictly consistent under concurrent writes, where PostgreSQL is the safer default
  • A record with many fixed relationships to other records, best enforced as foreign keys in a relational schema
  • A workload with many operations that must commit together across several records, where a relational database's transaction model is the more direct fit
  • A reporting layer joined across several structured tables, which a document store does not model as directly

Implementation patterns

A MongoDB schema starts from the document, not the table: fields that are read and written together live in one document, and a design that groups unrelated data into the same collection usually costs more at query time than it saves at write time. Indexes on the fields a query actually filters or sorts by matter as much here as in a relational database; an unindexed query at scale is a common cause of slow MongoDB performance, and the fix is almost always naming the right index rather than changing the data model. MongoDB supports multi-document ACID transactions across collections, databases and shards, so a workflow that occasionally needs several documents to commit together does not have to leave the document model entirely, though the documentation notes that a distributed transaction carries a real performance cost and should not replace good schema design as the default way documents stay consistent with each other.

Backups and operation follow the deployment shape chosen: a self-managed replica set needs its own backup, failover and upgrade plan, while MongoDB Atlas, the vendor's managed service, runs on AWS, Google Cloud or Azure and takes on provisioning, patching, backup, monitoring and scaling through the same MongoDB query API applications already use, so moving to it does not change application code. On the multi-tenant cloud ERP record, MongoDB is one of four database engines in the stack, alongside PostgreSQL, MySQL and MariaDB, for a US client that is not named; phase one, from 2020 to 2023, covered CRM, real-time messaging, HR, a knowledge base, custom fields and workflows, work and project management and API integrations.

What trade-offs should you weigh?

  1. Schema flexibility against enforced structure. A document model absorbs a changing shape without a migration for every new field, at the cost of the referential integrity a relational foreign key enforces automatically.
  2. Document-level consistency against cross-document guarantees. A single document write is always atomic; a workflow spanning several documents can use a multi-document transaction, but the documentation is explicit that this costs more than a single-document write and is not a substitute for a schema that keeps related data together.
  3. Self-managed control against a hosted service. Running MongoDB yourself keeps every configuration choice in house; MongoDB Atlas trades some of that control for provisioning, patching and scaling handled by the vendor, through the same query API either way.
  4. Licence terms for a service you resell. MongoDB ships under the Server Side Public License, which requires the source of any service built on it to be published if that service is offered to third parties over a network; running MongoDB to serve your own product does not trigger that condition the way reselling database access would.

A worked scenario

A hypothetical marketplace has a product catalogue where every category — electronics, clothing, furniture — carries different attributes, plus a stream of buyer and seller activity events that a fraud-review workflow reads, and an order and payment ledger that must stay strictly consistent.

  • Milestone one models the catalogue as documents, one per product, with category-specific fields nested directly in the document instead of a sparse table of optional columns.
  • Milestone two builds the activity-event collection with an index on seller ID and timestamp, the two fields the fraud-review workflow actually filters by.
  • Milestone three keeps the order and payment ledger in PostgreSQL rather than MongoDB, since that record needs the strict, cross-record consistency a relational schema enforces by default.
  • Milestone four wires a multi-document transaction only where an order genuinely must update more than one MongoDB document at once, rather than reaching for one by default.

Each milestone closes against real documents a reviewer can query, not a schema diagram, since a set of field names with nothing indexed is not evidence the catalogue performs under load.

Where does AI fit on a MongoDB deployment?

With AI, every new capability — a retrieval index, an evaluation pipeline, a model-scoring step — is new to every supplier, and Netbase takes each one on and combines it into delivery rather than waiting for a long track record to form first. On a MongoDB-backed catalogue or content store, that usually means a ranking or recommendation feature reads from the same governed documents through an API rather than copying them into a private store, while MongoDB continues to serve the product's own reads and writes. A workload that needs a dedicated retrieval or relevance index across several products at once is better scoped through a shared platform than built again inside each application's own database.

What to check before committing

MongoDB supports multi-document ACID transactions on replica sets and sharded clusters, with the primary required to run the WiredTiger storage engine and documented restrictions on which operations a transaction can include, such as creating a collection inside a cross-shard write transaction. MongoDB Atlas, the vendor's own hosted service, manages provisioning, patching, backup, monitoring and scaling across AWS, Google Cloud and Azure, through the same query API as a self-managed deployment. Confirm before scoping a build:

  • Whether the workload needs cross-document transactions at all, since the documentation is explicit that they cost more than single-document writes and should not replace a schema that keeps related data together.
  • Which fields a query actually filters or sorts by, so the right index exists before the collection grows large enough for its absence to matter.
  • Self-managed or Atlas, since the operational ownership differs even though the application-facing query API does not.
  • Whether the service built on MongoDB will be offered to third parties over a network, since the Server Side Public License's disclosure condition turns on exactly that.

Failure modes

  • A relational schema forced into documents

    Data with many fixed relationships to other records, modelled as documents instead of foreign keys, pushes integrity checks into application code that the database would otherwise enforce.

  • No index for the query that matters

    A collection that grows for months before anyone adds the index its main query needs degrades gradually until it is suddenly a production incident.

  • A cross-document transaction reached for by default

    Treating multi-document transactions as the normal way to keep data consistent, rather than an occasional tool, carries a real performance cost the documentation warns against.

  • Strictly consistent records kept in MongoDB anyway

    An order or payment ledger modelled as documents because the rest of the catalogue already lives there loses the consistency guarantees a relational schema gives those records for free.

What Netbase has built with MongoDB

MongoDB is part of the stack of the multi-tenant cloud ERP, for a client and product that are not named; phase one, from 2020 to 2023, covered CRM, messaging, HR, a knowledge base, custom fields and workflows, work and project management and API integrations. The underlying stack adds PostgreSQL, MySQL and MariaDB alongside MongoDB, deployed on AWS. These are delivered as Custom Product Engineering milestones: most Netbase projects are agreed as fixed-scope contracts after discovery, following discovery and strategic alignment, team assembly and architecture planning, agile execution with outcome-based milestones, modular components, training and rollout, and ongoing support.

Multi-tenant cloud ERP SaaS platform
Multi-tenant cloud ERP SaaS platform

This record covers phase-one scope for agency SMEs; the client and product are not named, and no usage or business result is claimed.

Keep Reading

Common questions

Not for records that must stay strictly consistent under concurrent writes, such as orders or payments; PostgreSQL is the safer default there, and MongoDB earns its place on data whose shape changes or nests.

Yes, MongoDB supports multi-document ACID transactions across collections, databases and shards, though the documentation notes they cost more than single-document writes and should not replace a schema that keeps related data together.

No. MongoDB Atlas, the vendor's managed service, runs on AWS, Google Cloud or Azure and takes on provisioning, patching, backup, monitoring and scaling, through the same query API a self-managed deployment uses.

No. A move between database engines is a data and query migration, not necessarily an application rewrite; the legacy data migration planning guide covers how that migration is scoped and verified.

Yes; both are common pairings, with MongoDB as the data layer behind a Laravel API or a Next.js front end that calls it.

It requires the source of a service built on MongoDB to be published only if that service is offered to third parties over a network; building MongoDB into your own product for your own customers does not trigger that condition.

Yes. Every service on this site is delivered remotely from Hanoi, and Netbase has worked with clients in 80 countries. Delivery communication is in English, with weekly reviews and a named project manager.

Netbase takes on projects in any industry where the work can be delivered remotely and accepted by milestones. The industry pages describe the approach sector by sector, and the Work records show delivered projects.

Payment is by bank transfer to the company account of Netbase JSC or through PayPal Business. The payee is always Netbase JSC, the company that operates OutsourcingVN.

Talk to Huy Nguyen (David), Founder and CEO of Netbase JSC: message him on WhatsApp at +84 937 869 689 or email project@netbasejsc.com. You can also send your brief through the project request form. Say which workflow or system the project concerns and what has to stay unchanged; the first step is a discovery conversation, and scope and milestones are agreed after it.

Custom product engineering for a bounded release outcome Custom product engineering for a bounded release outcome

One defined release of your product, built to named outcomes and handed over with acceptance evidence.

Learn More
line

From database decision to project

Bring the data whose shape changes or nests, the queries you run against it, and whether any part of the workflow needs strict cross-record consistency, and custom product engineering scopes the document design, indexing and operating model before a line of code is written; the other platform pages sit under Technologies, and a workload serving several AI or analytics features at once is scoped through data and AI platform engineering instead. A packaged product that already covers the workflow is worth weighing first through custom build versus SaaS. OutsourcingVN is operated by Netbase JSC and is Netbase's own outsourcing-services platform; submit a project with the data your application needs to hold.

Tell us what you want to build or automate.

Submit a project