I want to delete some documents that should not be used anymore. I tried to use the DELETE documents using the DELETE statement from N1QL command line and they are deleted from the server (or marked as tombstone) but once a client using couchbase lite (Android device here) is syncing with the database, it pushes all the deleted document to the remote server instead of deleting it in its local database.
Is their any way to delete documents remotely and propagate the deletion to every clients?
Thank’s but the REST API accept only one document ID. Isn’t it possible to delete documents resulted from a query ? (I want to permanently delete every documents that has type “xxx”)?
You can use _bulk_docs to delete multiple docs; just set the new body of each doc to {"_deleted":true}. You’ll also have to include a _rev property matching the document’s current revision ID, as you would with any document update.
Using _bulk_docs is the same problem, if I need to delete 1000 documents that result from a query like “select where type = x”, I won’t type every single document id by hand.
Using code seems the best approach but this doesn’t look very clean. I would have to code scripts every time I would like to delete documents based on a query.
We don’t have any new solution for doing something like this yet?! Using code with REST API is not a clean and good solution ​for lots of documents!