share / share/sharedb

Query.on('remove') to provide document contents instead of empty data

Open
#146 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
6.5k
Forks
456
Avg merge
1d 5h
Merged PRs (30d)
5

Description

In my scenario I have a subscribe query which notifies me about inserted and removed documents in a collection. I also have a tree data structure (a filesystem) in which I store these documents (see #145).
The problem is that when the query notifies me of one or more document removals, I'm unable to efficiently update the tree since the documents' data fields (which store information about where the document is stored inside the tree) have already been undefined. The current workaround is, for each removed document, to traverse the whole tree by comparing each stored document with the removed one. Instead it would be nice if the documents' data fields were emptied only after firing the event.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the Query.on('remove') event and the document-removal lifecycle to find where document data fields become undefined. Verify the event receives the document contents before those fields are cleared, and confirm the tree-update scenario can identify each removed document without traversing the whole tree.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend, database
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.