shiichan

DocumentDB 8.0.2 Adds 5 Aggregation Stages: $facet and $graphLookup Are Finally Here!

Hi everyone, it's Shii-chan!

AWS What's New aws.amazon.com

Today we're looking at Amazon DocumentDB minor version 8.0.2. It's packed with features, so let's go through them one by one.

What was announced?

AWS What's New announced minor version 8.0.2 of Amazon DocumentDB (with MongoDB compatibility). It expands MongoDB API compatibility and improves query performance, making it easier to migrate MongoDB workloads without application code changes.

Why it matters

DocumentDB is a MongoDB-compatible managed database, so a common blocker is that an aggregation stage or event you rely on isn't supported yet. 8.0.2 fills in a bunch of those compatibility gaps at once.

What changes

  • Aggregation pipelines can use window functions, faceted search, and hierarchical queries
  • Change events larger than 16 MB can be handled
  • Queries that can be answered from an index alone get faster

Dive Deep

Here are the main new capabilities in 8.0.2.

  • Retryable writes: insert, update, and delete operations automatically retry on transient network errors, improving resilience during failovers
  • New aggregation stages: $setWindowFields (with its full set of window operators), $bucketAuto, $facet, $graphLookup, and correlated $lookup, for advanced analytics, faceted search, and hierarchical queries
  • Change stream enhancements:
    • The $changeStreamSplitLargeEvent stage splits change events larger than the 16 MB limit into fragments
    • Change streams now emit events for createCollection and createIndex operations
  • Query performance improvements (from query planner enhancements):
    • Index-only scans for find and aggregation queries
    • Index scans on $expr predicates
    • Incremental sort
    • Faster count and countDocuments()
  • Index management: support for the reIndex command on partial indexes

On availability, the announcement says all regions where Amazon DocumentDB is available. For details, see the Supported MongoDB APIs, operations, and data types documentation.

Wrap-up

  • Retryable writes are supported
  • 5 new stages: $setWindowFields, $bucketAuto, $facet, $graphLookup, and correlated $lookup
  • Large change events can be split, and createCollection / createIndex now emit events
  • Query performance improves, including index-only scans
  • reIndex works on partial indexes

This is for anyone planning a move from MongoDB to DocumentDB, or who leans heavily on aggregation pipelines!