Skip to content

Releases: danmacko/meteor-publish-relations

v3.0.2

Choose a tag to compare

@danmacko danmacko released this 11 Jun 05:39

Patch release: fixes the remaining "Mongo server and the Meteor query disagree"
oplog warning on filtered / paginated joins. Drop-in upgrade — no API changes.

Highlights — fixes the "disagree on how many documents" oplog warning

3.0.0 fixed leaked observers and unbounded $in growth, but the warning

The Mongo server and the Meteor query disagree on how many documents match your query

could still appear on busy filtered / sorted / paginated joins. The remaining
root cause was a shared, mutable $in:

  • The join passed its live this.data array to the observe by reference and
    mutated it in place (push / removal) as the result set changed.
  • minimongo compiles a $in matcher by snapshotting the array at observe
    creation
    , while the Mongo query re-reads the live array on every poll. Since
    the observe restart is deferred, a live observe could match against the frozen
    $in while Mongo queried the already-mutated one — the two disagreed on the
    count, which is exactly what the oplog driver logs.

3.0.2 hands each observe its own snapshot of the joined ids
(this.data.slice()), so the compiled matcher and the Mongo query always agree.
In-place mutations now only affect the next observe, created on restart.

Performance

  • Released ids are now dropped from the $in in a single filter pass (O(n))
    instead of indexOf + splice per id (O(k·n)).

Upgrading

Drop-in from 3.0.1 — no API changes.

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.

v3.0.0

Choose a tag to compare

@danmacko danmacko released this 10 Jun 13:54

Builds on v2.0.9 and trims the package down to its reactive-join core.

Breaking changes

  • Removed the Crossbar pagination/listen API: this.paginate(),
    this.listen(), PublishRelations.changePag() and PublishRelations.fire()
    are gone. They relied on the DDPServer._InvalidationCrossbar internal, which
    complicates compatibility across Meteor majors, and were rarely used. To
    paginate, re-subscribe with a new limit / skip.

Internal

  • Dropped the underscore, ddp-server and check dependencies — underscore
    helpers were replaced with native equivalents. The package now depends only on
    ecmascript.
  • No change to the core this.cursor / this.join / this.observe API.

If you use this.paginate() / this.listen(), stay on v2.0.9.

v2.0.9

Choose a tag to compare

@danmacko danmacko released this 10 Jun 13:54

Maintained fork of cottz:publish-relations
by lfades (MIT).

This bugfix release fixes the long-standing oplog error from this.join():

The Mongo server and the Meteor query disagree on how many documents match your query

Fixes

  • Stop leaked join observers — when a join cursor was re-issued with a new
    selector, the previous observeChanges handler was overwritten without being
    stopped, leaving a stale observer running against an older $in selector. It
    is now stopped before being replaced.
  • Shrink the join $in on contributor removal — joined ids were only ever
    added, never released, so the $in grew without bound on long-lived / busy
    subscriptions and eventually diverged from Mongo during oplog reconciliation.
    The $in is now refcounted per joined id and shrinks when contributor
    documents are removed (dropped documents are explicitly retracted from the
    client), while staying fully reactive.

Fully backwards compatible with cottz:publish-relations — same API.