Remove multiple documents
The body of the request is an array consisting of selectors for documents. A selector can either be a string with a key or a string with a document handle or an object with a _key attribute.
This API call removes all specified documents from collection. If the selector is an object and has a _rev attribute, it is a precondition that the actual revision of the removed document in the collection is the specified one.
The body of the response is an array of the same length as the input array. For each input selector, the output contains a JSON object with the information about the outcome of the operation. If no error occurred, an object is built in which the attribute _id contains the known document-handle of the removed document, _key contains the key which uniquely identifies a document in a given collection, and the attribute _rev contains the document revision.
In case of an error, an object with the attribute error set to true and errorCode set to the error code is built. If the query parameter returnOld is true, the previous revision of the document is returned under the old attribute in the result.
Note that if any precondition is violated or an error occurred with some of the documents, the return code is still 200 or 202, but the additional HTTP header X-C8-Error-Codes is set, which contains a map of the error codes that occurred together with their multiplicities, as in: 1200:17,1205:10 which means that in 17 cases the error 1200 "revision conflict" and in 10 cases the error 1205 "illegal document handle" has happened.
Request
- The document declares no server URL.
- Auth
- API key in header Authorization
- or HTTP bearer
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Path parameters
The name of the fabric.
Collection from which documents are removed.
Query parameters
If set to true, adds the old attribute which displays original document.
If set to true, ignore any _rev attribute in the selectors. No revision check is performed.
If set to true, returns only after data has been synced to disk.
Request body
Example request
[ "key" ]
Response
Successfully removed documents when waitForSync is enabled.
Example response
[
{
"_id": "test/foo",
"_key": "foo",
"_rev": "_dPRuHxe--_"
}
]Changes
No recorded changes to this operation across all 1 revision of this API.