curl --request DELETE \
--url https://api.example.com/{collection}/batch \
--header 'Content-Type: application/json' \
--data '
{
"ids": [
{}
],
"filter": {}
}
'{
"deleted": 123,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}Delete multiple documents matching IDs or filter criteria
curl --request DELETE \
--url https://api.example.com/{collection}/batch \
--header 'Content-Type: application/json' \
--data '
{
"ids": [
{}
],
"filter": {}
}
'{
"deleted": 123,
"error": {
"code": "<string>",
"message": "<string>",
"details": {}
}
}Documentation Index
Fetch the complete documentation index at: https://mintlify.com/KTS-o7/permission-mongo/llms.txt
Use this file to discover all available pages before exploring further.
ids or filter must be provided.Maximum: 1000 IDs (configurable)ids or filter must be provided.{
"ids": [
"65f1a2b3c4d5e6f7a8b9c0d1",
"65f1a2b3c4d5e6f7a8b9c0d2",
"65f1a2b3c4d5e6f7a8b9c0d3"
]
}
{
"filter": {
"status": "archived",
"created_at": {
"$lt": "2023-01-01T00:00:00Z"
}
}
}
{
"deleted": 47
}
handlers_batch.go:546-556:
For collections with versioning enabled, the current state of each document is saved as a version snapshot before deletion. This allows for potential recovery through the version history.
handlers_batch.go:559-595:
handlers_batch.go:541-544:
The provided filter/IDs are combined with RBAC query filters to ensure users can only delete documents they have permission to access.
filter parameter supports MongoDB query operators:
{
"filter": {
"status": "archived",
"last_login": { "$lt": "2023-01-01T00:00:00Z" },
"email_verified": false,
"role": { "$in": ["guest", "trial"] }
}
}
$eq, $ne: Equal, not equal$gt, $gte, $lt, $lte: Comparison operators$in, $nin: Array membership$and, $or, $not: Logical operators$exists: Field existence check$regex: Pattern matchingdeleted field and filtering it in queries instead of hard deletesdelete permission for the collectionids or filter must be provided (not both)ids parametercollection_not_found: Collection does not existforbidden: User lacks delete permissionbad_request: Invalid request (missing ids/filter, invalid IDs, batch size exceeded)internal_error: Database operation failed{
"error": {
"code": "bad_request",
"message": "Either 'ids' or 'filter' must be provided"
}
}
{
"error": {
"code": "bad_request",
"message": "Batch size exceeds maximum limit of 1000",
"details": {
"max_batch_size": 1000,
"requested": 1500
}
}
}
handlers_batch.go:597-602
pkg/api/handlers_batch.go:461-610