Skip to content

v3.0.2

Latest

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.