Collation reaches every read path; `$unionWith` / `$redact` / `$setWindowFields` land
Summary: Collation reaches every read path; $unionWith / $redact / $setWindowFields land (v0.5.2b1).
Eleven slices in one beta. The collation domain — the per-query
collation argument that mongod's drivers carry on every CRUD call —
now reaches every read path: single-field equality / range / $in
(b25), compound bare-equality and prefix + trailing-operator (b27),
and sort acceleration both single-field and multi-field compound
(b28). The rule throughout is exact-match: an index with
collation: {strength: 2} is only picked when the query carries
the same collation, and mismatch falls back to COLLSCAN with
matches() in hand. Unique compound indexes with a collation
enforce uniqueness under the collation, so ("Alice", "Boston")
and ("ALICE", "BOSTON") collide on the second insert.
Three v1 stable-API aggregation stages wired up. $unionWith
concatenates docs from another collection through an optional
sub-pipeline; outer docs come first, then union docs, no
deduplication. $redact is mongod's pipeline-side
content-based pruning mechanism — the expression returns one of
"$$KEEP", "$$PRUNE", "$$DESCEND" per (sub-)document and the
stage walks top-down, dropping or recursing as instructed.
$setWindowFields ships as a minimum-viable subset: partition +
sort + the nine $group accumulators ($sum / $avg / $min /
$max / $first / $last / $push / $addToSet / $count)
against position-based documents: [<lower>, <upper>] windows
with the "current" / "unbounded" bound forms. Range-based
windows, time-series functions, and rank functions all raise with
a clear "not yet implemented" message rather than silently doing
the wrong thing — the gap is visible from the wire.
Three smaller-but-quietly-load-bearing fixes round out the release.
admin.system.users and admin.system.version are now synthetic
read-only views onto the user store and the auth-schema doc
respectively (b31 + b33), so tools that introspect via
db.system.users.find() or
admin.system.version.findOne({_id: "authSchema"}) get real
answers instead of empty collections; writes are rejected with
mongod's Unauthorized (code 13). $type: "int" versus "long"
now distinguishes by BSON type tag rather than Python value range,
so a doc inserted as bson.Int64(5) correctly matches
$type: "long" (b29) — pymongo's decoder already preserves the
distinction by class; only the predicate had to follow. And
renameCollection cross-process safety turned out to be
structurally guaranteed by WiredTiger's WiredTiger.lock
exclusion: a second wiredtiger_open on the same data directory
fails with a Resource busy-class error before any state is
touched, so concurrent cross-process writers can't exist in the
first place (b34, no code change beyond a regression test).