Batch Delete Documents
POST/collections/:collectionName/documents/remove
Delete documents matching the query conditions. Uses POST method because complex query conditions need to be passed in the request body.
The query cannot be an empty object (to prevent accidental deletion of all data). Non-admin users will have _openid conditions automatically injected.
Request
Path Parameters
collectionName stringrequired
Collection name
- application/json
Body
required
query objectrequired
Query conditions (EJSON object, cannot be empty)
multi boolean
Whether to delete multiple documents
transactionId string
Transaction ID
Responses
- 200
- 400
Delete successful
- application/json
- Schema
- Example (from schema)
- Example
Schema
deleted integer
Number of deleted documents
{
"deleted": 0
}
{
"deleted": 1
}
Invalid request parameters
- application/json
- Schema
- Example (from schema)
Schema
code string
Error code
message string
Error message
request_id string
Unique request ID
{
"code": "INVALID_PARAM",
"message": "param.query can't be empty",
"request_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
Loading...