earthstar-project / earthstar

Storage for private, distributed, offline-first applications.
https://earthstar-project.org
GNU Lesser General Public License v3.0
633 stars 20 forks source link

Add "contentIsEmpty" query field for deleted documents #42

Open cinnamon-bun opened 4 years ago

cinnamon-bun commented 4 years ago

What's the problem you want solved?

"Deleted documents" are docs with content: "".

We need to preserve them behind the scenes, as tombstones.

Sometimes we want them (when syncing), and sometimes not (when showing things in a UI).

Is there a solution you'd like to recommend?

cinnamon-bun commented 4 years ago

Added in https://github.com/earthstar-project/earthstar/commit/34e9c758223fdf31250738f676eae73597132b90

    // If true, only match documents with content === "" (e.g. deleted documents)
    // If false, only match documents with content.length >= 1
    // If omitted, match all documents.
    contentIsEmpty?: boolean,

Tests pass with memory storage, but not all tests pass with sqlite storage. We're stuck waiting to figure out #44 to define what the right behavior should be.