Skip to content

v3.0.1

Choose a tag to compare

@danmacko danmacko released this 11 Jun 05:36

Patch release: fixes a $in leak in nested joins when an outer parent document
leaves the result set. Drop-in upgrade from 3.0.0 — no API changes.

Highlights — release nested joins when a parent leaves the result set

A join refcounts its $in by the innermost contributor — the document in the
deepest nested cursor / join callback. In 3.0.0 the $in shrank correctly
when that innermost contributor was removed directly, but not when an outer
parent
dropped out of the result set:

  • When an outer parent document leaves (e.g. filtered out, or pushed out of a
    paginated window — without being deleted), its nested observer is only
    stopped. A stopped observer does not fire removed, so the joined ids the
    parent's nested contributors were keeping alive were never released and leaked
    in the $in.
  • On filtered / sorted / paginated parent cursors where documents churn in and
    out of the result set, the $in grew over time and the join over-published.

3.0.1 tracks parent → children and cascades the release: removing a parent now
also releases the ids held by its nested contributors. Refcounts keep ids shared
across multiple parents alive until the last parent leaves.

Upgrading

Drop-in from 3.0.0 — no API changes.