-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot index deleted documents with Mango #1355
Comments
Interestingly, this issue goes all the way back to COUCHDB-1530, aka "Add a mode to _all_docs to include deleted docs". In that issue @davisp was +1 on the idea. Right now the only way to get a list of tombstones in a DB is to pull the changes feed and filter on _deleted:true. |
Is this still the case and the only way to get a list of deleted documents, use a list of tombstones via change feed ? 😞 |
Yes. |
Why? But why did CouchDB choose these strange pattern... |
Because no one has written the code to change it yet. It clearly hasn't been a priority for anyone. Complaining here isn't going to change anything. Writing the code to change the behaviour, and submitting it as a pull request, probably would. |
Mango indexes cannot be used to index deleted documents, though it would sure be nice if they could.
Expected Behavior
Given a Mango index like this:
A query against that index should return any deleted documents. For example, this request with curl:
It should return deleted documents.
Current Behavior
Indexing the
_deleted
field creates indexes that return no documents. For example, consider this query using the index from above:It returns nothing, but it's clear that Mango considers the index valid and indeed can detect that it has been requested.
Whereas a Map-Reduce view can be used to filter a changes feed to return changes pertaining to deleted documents, using a Mango index in this way results in an error:
As such, it is currently not possible to index deleted documents or to filter changes for deleted documents using a Mango index.
Possible Solution
🤷♀️
If a Map-Reduce view can be used to filter a changes feed for deleted (or un-deleted) documents, then perhaps Mango indexes can be applied in a similar way to achieve the same result.
Steps to Reproduce (for bugs)
Here are the curl commands I used to produce this issue:
That final request should yield a response that includes no documents.
Context
It is occasionally important to find deleted documents en masse, such as while managing tombstones under conditions where other mitigation techniques are not available.
Your Environment
The text was updated successfully, but these errors were encountered: