MongoDB 8.0, released in August 2024, is the most performance-focused major release in the database's history. With up to 36% faster query execution, new queryable encryption capabilities, time series improvements, and a significantly enhanced aggregation framework, MongoDB 8.0 changes the calculus for enterprise document database deployments.
MongoDB 8.0: What Changed and Why It Matters
MongoDB 8.0 focuses on three pillars: performance (substantial query engine improvements across all workload types), security (expanded queryable encryption making confidential computation practical at scale), and developer experience (new aggregation operators, improved time series capabilities, and enhanced Atlas features). For enterprises running MongoDB in production, the performance improvements alone make upgrading compelling.
Query Engine and Performance Improvements
The most significant technical change in MongoDB 8.0 is a rewrite of the query execution engine internals. MongoDB 8.0 introduces a new "slot-based execution engine" (SBE) that has been extended to cover more query patterns, combined with improved index utilisation and smarter query planning.
Queryable Encryption: Confidential Computing at Scale
Queryable Encryption (QE), first introduced in MongoDB 6.0 as a preview, reaches production maturity in MongoDB 8.0. It allows applications to encrypt sensitive fields client-side before storing them in MongoDB, while still supporting equality queries, range queries, and prefix searches on the encrypted data — without the database server ever seeing the plaintext.
| Query Type | Supported in MongoDB 8.0 QE | Notes |
|---|---|---|
Equality queries (field: value) | ✓ Supported | Full equality matching on encrypted fields |
Range queries ($gt, $lt, $between) | ✓ Supported | New in 8.0; numeric and date ranges |
| Prefix/starts-with | ✓ Supported | String prefix search on encrypted strings |
| Full-text / regex search | ✗ Not supported | Requires plaintext; design data model accordingly |
| Aggregation on encrypted fields | Partial | $match supported; $group/$avg not on encrypted fields |
Queryable Encryption is particularly valuable for regulated industries: healthcare (HIPAA PHI field encryption), financial services (PCI-DSS cardholder data), and any application storing personally identifiable information subject to data breach notification laws. With QE, a database compromise exposes only ciphertext — useless without the client-held encryption keys.
Time Series Collection Improvements
MongoDB 8.0 delivers significant improvements to time series collections (introduced in MongoDB 5.0), making them competitive with purpose-built time series databases for many workloads:
- Arbitrary field updates: MongoDB 8.0 removes the previous restriction on updating non-metric fields in time series documents. Updates to metadata fields are now supported, removing a major usability limitation.
- Faster bucket queries: Optimised bucket-level pruning reduces the data scanned when querying specific time windows, delivering up to 2× faster range queries on large time series collections.
- $densify and $fill improvements: Aggregation operators for time series gap filling and data densification are significantly faster in 8.0, making time series analytics pipelines more practical at scale.
- Columnar compression: Time series collections use a new columnar storage layout for metric fields within buckets, improving compression ratios by 20–40% compared to 7.0.
New Aggregation Operators
MongoDB 8.0 adds several useful aggregation operators that simplify common patterns previously requiring verbose workarounds:
// $percentile - compute percentile values in aggregation (new in 8.0)
db.orders.aggregate([
{
$group: {
_id: "$region",
p50_value: { $percentile: { input: "$orderValue", p: [0.5], method: "approximate" } },
p95_value: { $percentile: { input: "$orderValue", p: [0.95], method: "approximate" } }
}
}
]);
// $median - shorthand for 50th percentile
db.products.aggregate([
{ $group: { _id: "$category", medianPrice: { $median: { input: "$price", method: "approximate" } } } }
]);
Other new operators include $bitAnd, $bitOr, $bitXor, and $bitNot for bitwise operations on integer fields, and improvements to $lookup that support pipeline-based lookups with better performance.
MongoDB Atlas Enhancements in 8.0
- Vector Search now GA — store and query vector embeddings for AI/ML applications
- Hybrid search (full-text + vector) in a single query
- Faster index builds for large collections
- New ENN (Exact Nearest Neighbor) mode for smaller datasets
- Query across Atlas clusters, S3, and Atlas Data Lake in a single query
- Improved pushdown of aggregation stages to remote sources
- New $out to Atlas Data Lake for automated analytical data export
- Parquet format support for data lake integration
Upgrade Considerations: MongoDB 7.0 to 8.0
$where operator (security risk — use $expr instead); certain map-reduce options replaced by aggregation pipeline equivalents; and legacy role names. Run compatibility tests in staging before upgrading production.