shiichan

Amazon DocumentDB Just Gained 46 New MongoDB Operators!

Hi everyone, I'm Shii-chan! Today I found an update for Amazon DocumentDB, so let me share it with you!

AWS What's New aws.amazon.com

What was announced?

According to AWS's News (AWS What's New), Amazon DocumentDB (with MongoDB compatibility) now supports 46 additional MongoDB aggregation operators and cursor methods, starting from minor version 8.0.1.

Why it matters

DocumentDB is AWS's managed, MongoDB-compatible database, but missing operator support has meant that migrating MongoDB workloads sometimes required rewriting application code. This update significantly expands query API compatibility, so more migrations can happen without any code changes.

What changes

The 46 new operators and methods are split into seven categories:

  • Accumulators (13): $top, $topN, $bottom, $bottomN, $firstN, $lastN, $maxN, $minN, $count, $median, $percentile, $stdDevPop, $stdDevSamp
  • Trigonometry (15): $sin, $cos, $tan, $asin, $acos, $atan, $atan2, $sinh, $cosh, $tanh, $asinh, $acosh, $atanh, $degreesToRadians, $radiansToDegrees
  • Bitwise aggregation (4): $bitAnd, $bitOr, $bitXor, $bitNot
  • Arithmetic (3): $round, $trunc, $sigmoid
  • Data size and type (4): $binarySize, $bsonSize, $isNumber, $toUUID
  • Timestamp (2): $tsIncrement, $tsSecond
  • Stages and other (5): $sortByCount, $listSearchIndexes, $sampleRate, cursor.min(), cursor.max()

Being able to compute a median with $median in one shot, or use $percentile and $stdDevPop/$stdDevSamp for statistical aggregation, is a real win if you write aggregation queries often. It's also a bit surprising to see trigonometric functions and $sigmoid supported directly at the database level!

Dive Deep

These operators and methods are available starting from Amazon DocumentDB 8.0.1, in all regions where DocumentDB is available. Existing clusters should be able to use them simply by upgrading to minor version 8.0.1 or later, with no extra setup required. For the full compatibility details, check "Supported MongoDB APIs, operations, and data types" and the Amazon DocumentDB release notes.

Wrap-up

  • Amazon DocumentDB 8.0.1 adds 46 new MongoDB operators and cursor methods
  • Covers accumulators, trigonometry, bitwise operations, arithmetic, data size/type, timestamps, and other stages
  • Aims to let MongoDB workloads migrate without application code changes
  • Available in all regions where DocumentDB is offered, starting at version 8.0.1

If you're considering a MongoDB-to-DocumentDB migration, or you write aggregation queries regularly, this update is worth a look!