Skip to content
← All articlesSoftware & development

MongoDB Features: Documents, Indexes and Replication

Layered document cards with coloured fields arranged into database-like groups

MongoDB is a document database. Its document model, indexing and replication address different application needs; choosing it should begin with the records and queries your product actually requires. A flexible data model does not remove the need for validation, security or recovery planning.

Choose MongoDB features deliberately

Choose MongoDB features deliberately
Choose MongoDB features deliberately
Choose MongoDB features deliberately
FocusPractical approachCheck before proceeding
DocumentsModel records around real reading and writing patterns.Flexible fields still need consistent application rules.
IndexesSupport the queries your application actually runs.Extra indexes add storage and write overhead.
ReplicationPlan availability and recovery requirements.Replication does not replace independent backups.

Documents and application records

Consider a product catalogue in which clothing, electrical goods and food have different attributes. Documents can represent those differences without forcing every product to use an identical set of fields. The application still needs rules for common values such as identifiers, prices and availability. Decide which fields are required and how older documents behave when the application changes.

Indexes support particular queries

An index can help a database find records for a suitable query without examining the entire collection. Start with actual access patterns: looking up an order by reference is different from listing products by category and price. Inspect query plans and measure representative data. Adding indexes indiscriminately increases storage and maintenance work, particularly when records are written frequently.

Replication and recovery solve different problems

Replication maintains copies of data across members of a replica set and supports availability. It should not be treated as a substitute for a separate backup and recovery plan. A mistaken application change can affect replicated data too. Define how much data loss is tolerable, who can restore the system and how restoration will be tested.

Before selecting the database

Write down the busiest queries, expected document sizes, update patterns and reporting needs. Prototype the difficult workload rather than only the easiest screen. Compare the operating requirements with the skills of the team that will support it. A relational database may still be the better choice where the data relationships and transaction requirements favour that model.

Useful next steps

For a related perspective, read MongoDB Data Modelling: Documents and Relationships, When to Use Node.js for APIs and Realtime Features, Docker and Kubernetes: Packaging and Operating Applications.

If you need help applying this to your business, explore our custom software development or discuss your project.

Sources and further reading

By Tech Me Today. Originally published December 6, 2023. Expanded on .

Explore all articles →
KEEP READING

More ideas. Fresh perspective.

Layered index-card stacks linked by fine thread to represent data relationships
Software & development

MongoDB Data Modelling: Documents and Relationships

Design a MongoDB model around the way an application reads and updates its data. Documents contain fields and values, collections group documents, and relationships can be represented through embeddin…

September 22, 2023↗
Compact computer and terminal monitor in a small development lab
Software & development

When to Use Node.js for APIs and Realtime Features

Node.js is a JavaScript runtime, not a programming language. It runs JavaScript outside the browser and is commonly used for services, command-line tools and application backends. Choosing it should d…

October 13, 2023↗
Rows of server cabinets in a modern data centre
Software & development

Docker and Kubernetes: Packaging and Operating Applications

Containers package applications with their dependencies to support more consistent delivery. Docker provides tools for working with containers, while Kubernetes orchestrates containerised workloads. T…

December 27, 2023↗
LET’S MAKE IT HAPPEN

What would make your
business work better?

Tell us what you want to build, improve or automate.

Let’s talk about your project