$rank for $setWindowFields, apiStrict distinct rejection, +80 pymongo tests
Summary: $rank for $setWindowFields, apiStrict distinct rejection, +80 pymongo tests (v0.5.2b5).
Three slices land on top of last week's 0.5.2b1, each one closing a
gap the previous release explicitly deferred. $setWindowFields
gains the three rank functions — $rank (1-indexed with gaps after
ties: [10, 20, 20, 30] → [1, 2, 2, 4]), $denseRank (no gaps:
[1, 2, 2, 3]), and $documentNumber (1-indexed slot position).
They share one linear walk per partition and sit in output: {<field>:
{$rank: {}}} alongside the accumulator functions, but evaluate
differently — no window argument (mongod rejects it), no function
argument, and the value is computed once per partition slot rather
than rolled up over a windowed subset. Tie detection is sort-key
tuple equality so compound sortBy specs work uniformly; rank
counters reset at every partition boundary. Time-series window
functions ($shift / $locf / $derivative / $integral /
$linearFill / $expMovingAvg) still raise with a clear message.
The Stable API v1 contract's apiStrict: true now rejects the
distinct command with code 323 (APIStrictError) — the canary
command the spec's unified test runners actively probe. A previous
attempt at the broad-whitelist invert had reportedly caused 6
cascade failures via MongoConnectionPoolClearedException. This
release takes the empirical approach instead: a focused
_API_V1_REJECTED_BY_NAME = {"distinct"} gate, run against the
full mongo-java-driver suite. Result: +1 pass for the canary
crud-api-version-1-strict.yml distinct appends declared API
version test, zero new failures, zero pool-clear symptoms
across the 900-test suite. The previous theory turned out wrong
about the mechanism — the cascade was the broader invert also
rejecting count (used internally by estimatedDocumentCount)
and other handshake-adjacent commands, not pool-clear semantics.
The pymongo conformance gauge — the headline "MongoDB
compatibility" number — went from 959 to 1039 passing tests
(+80), with zero new failures and the overall pass rate staying
at 100%. A cross-gauge audit identified five test files that pass
cleanly now and had been excluded purely because the supporting
features hadn't shipped: test_collation.py (unlocked by the
per-index collation work in 0.5.2b1), test_versioned_api.py and
test_versioned_api_integration.py (apiStrict gates), and
test_command_logging.py + test_logger.py (no SecantusDB
blocker, just hadn't been opted in). All five validation reports
(pymongo, go, node, java, ruby) were re-run and refreshed in the
same release cycle — the Java gauge in particular hit 100% pass
rate, with the three previously-failing driver-sync tests
(distinct strict-mode plus two CommandMonitoringTest cases)
now passing.