Latest Pre-release in branch 6.2 (Rapid Release)
6.2.1-rc1
Released 17 Feb 2023
(3 years ago)
SoftwareMongoDB Server
Version6.2 (Rapid Release)
Status
End of life
Initial release6.2.0
12 Jan 2023
(3 years ago)
Latest release6.2.1-rc1
17 Feb 2023
(3 years ago)
End of life30 Nov 2022
(Ended 3 years ago)
Release noteshttps://www.mongodb.com/docs/manual/release-notes/6.2/
Documentationhttps://www.mongodb.com/docs/v6.2/
Downloadhttps://www.mongodb.com/try/download/community
MongoDB Server 6.2 (Rapid Release) ReleasesView full list

What Is New in MongoDB 6.2

MongoDB 6.2 is a rapid release packed with enhancements that improve developer productivity, query performance, and operational flexibility. It introduces new aggregation operators, expands time series capabilities, and refines the sharding experience.

Category Key Changes
New Features New aggregation operators ($dateAdd, $dateSubtract, $getField, etc.), Compound Hashed Sharding, Hedged Reads
Time Series Delete and compact commands, columnar compression
Queryability Wildcard support on $group _id, $first/$last array operators
Security & Operations Audit log filtering, cluster-wide initial sync, resumable index builds on standalone

How does MongoDB 6.2 improve aggregation pipelines?

The aggregation framework gets a significant boost with new operators that simplify complex date manipulations and document traversals. The $dateAdd and $dateSubtract operators provide a more intuitive way to perform date arithmetic compared to the older $add and $subtract methods.

For data restructuring, $getField, $setField, and $unsetField allow you to dynamically access and modify fields using string expressions. This is huge for processing documents with variable schemas. You can also use wildcard projections like "$price.*" within a $group's _id field for more flexible grouping logic.

// New date arithmetic
{
  $project: {
    newDate: {
      $dateAdd: {
        startDate: "$orderDate",
        unit: "day",
        amount: 7
      }
    }
  }
}

What new sharding options are available?

Compound Hashed Sharding lets you create a shard key that combines a ranged field with a hashed field. This gives you better distribution for write-heavy workloads while still allowing some range-based query efficiency. It's a solid middle ground between pure hashed and pure ranged sharding.

Hedged Reads are now generally available, letting mongos instances send read operations to multiple replicas and return the first response. This drastically reduces tail latency for queries in globally distributed clusters, especially when some replicas might be experiencing network issues.

How are time series collections enhanced?

You can now run delete operations on time series collections, which was a major limitation before. The new compact command helps reclaim disk space after large deletions, making time series data much more manageable for evolving use cases.

Columnar compression gets support for zstd compression, offering better compression ratios for your time series data. This means lower storage costs and better I/O performance for large-scale time series workloads.

// Deleting data from a time series collection
db.weather.deleteMany({
  "metadata.sensorId": 107,
  "timestamp": { $lt: ISODate("2022-01-01") }
})

What operational improvements should I know about?

Cluster-wide initial sync allows a new node to sync from any eligible member of the replica set, not just the primary. This reduces load on the primary during scaling operations and makes replica set recovery more flexible.

Standalone servers now support resumable index builds. If you're building a large index and the server restarts, it'll pick up where it left off instead of starting from scratch. For operators, you can now filter audit log output by users or roles, making security reviews more focused.

FAQ

Can I use the new aggregation operators like $dateAdd in older MongoDB versions?
No, these operators are specific to MongoDB 6.2. If you try to use them against an older server version, the aggregation pipeline will fail with an unrecognized operator error.

Does Compound Hashed Sharding replace existing sharding strategies?
It doesn't replace them"it adds a new option. You can still use hashed, ranged, or zoned sharding depending on your use case. Compound Hashed is particularly useful when you need both distribution and some range query efficiency.

What happens if I delete data from a time series collection?
The delete operation marks the underlying data for removal, but the physical disk space isn't immediately reclaimed. You need to run the compact command afterward to actually free up the space, similar to how it works with regular collections.

Are Hedged Reads enabled by default?
No, you need to enable them explicitly by setting the readPreference to "hedged" in your connection string or driver configuration. They're designed for scenarios where low latency is more critical than absolute consistency.

Can I use wildcard projections in $group with nested fields?
Yes, the new wildcard support in $group _id fields works with nested document structures. For example, you can use "metadata.*" to group by all fields within a metadata subdocument.

Releases In Branch 6.2 (Rapid Release)

VersionRelease date
6.2.1-rc117 Feb 2023
(3 years ago)
6.2.117 Feb 2023
(3 years ago)
6.2.1-rc013 Feb 2023
(3 years ago)
6.2.0-rc612 Jan 2023
(3 years ago)
6.2.012 Jan 2023
(3 years ago)
6.2.0-rc509 Jan 2023
(3 years ago)
6.2.0-rc412 Dec 2022
(3 years ago)
6.2.0-rc308 Dec 2022
(3 years ago)
6.2.0-rc201 Dec 2022
(3 years ago)
6.2.0-rc016 Nov 2022
(3 years ago)
6.2.0-rc116 Nov 2022
(3 years ago)
6.2.0-alpha23 Aug 2022
(3 years ago)