Meteor-Community-Packages / Meteor-Community-Packages/ground-db

[2.0] observeSource API / docs confusing

Open
#183 7 comments 0 reactions 0 assignees View on GitHub
enhancement help wanted
Dominant language
JavaScript
Stars
569
Forks
77
PR merge metrics
No merged PRs in 30d

Description

I had assumed that `observeSource` would make the GroundDB collection match the collection it was observing. But that doesn't appear to be the case. I think I need to call `keep` first to make the collections match and then `observeSource` to keep it up to date, otherwise old records might be lying around in the GroundDB collection.

I can understand the need for both cases. Should there be a different method or some options to choose to leave records not matching the cursor?

Combining these two steps could also be more efficient since at the moment `observeSource` will run through all the existing docs again to do the initial `added` just after `keep` has. If there was a combined call then `_suppress_initial` could be used and the existing docs updated while calculating the ones to remove.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the observeSource and keep APIs and their documentation to establish whether observeSource removes records outside the cursor. Compare the initial added behavior after keep with the requested combined operation, then define the desired option or method semantics and document when existing records are retained or removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.