Releases: danmacko/meteor-publish-relations
Release list
v3.0.2
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.dataarray to the observe by reference and
mutated it in place (push/ removal) as the result set changed. - minimongo compiles a
$inmatcher 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
$inwhile 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
$inin a singlefilterpass (O(n))
instead ofindexOf+spliceper id (O(k·n)).
Upgrading
Drop-in from 3.0.1 — no API changes.
v3.0.1
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 fireremoved, 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$ingrew 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
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()andPublishRelations.fire()
are gone. They relied on theDDPServer._InvalidationCrossbarinternal, which
complicates compatibility across Meteor majors, and were rarely used. To
paginate, re-subscribe with a newlimit/skip.
Internal
- Dropped the
underscore,ddp-serverandcheckdependencies — underscore
helpers were replaced with native equivalents. The package now depends only on
ecmascript. - No change to the core
this.cursor/this.join/this.observeAPI.
If you use this.paginate() / this.listen(), stay on v2.0.9.
v2.0.9
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 previousobserveChangeshandler was overwritten without being
stopped, leaving a stale observer running against an older$inselector. It
is now stopped before being replaced. - Shrink the join
$inon contributor removal — joined ids were only ever
added, never released, so the$ingrew without bound on long-lived / busy
subscriptions and eventually diverged from Mongo during oplog reconciliation.
The$inis 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.