You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If `true`, includes soft-deleted documents (where `isDeleted: true`) in the aggregation. Defaults to `false`.
24
+
</ParamField>
25
+
26
+
### Request body
27
+
28
+
<ParamFieldbody="pipeline"type="array"required>
29
+
An array of aggregation stages following the standard MongoDB aggregation pipeline syntax.
30
+
</ParamField>
31
+
32
+
<Note>
33
+
For security reasons, certain stages like `$out` and `$merge` are blocked.
34
+
</Note>
35
+
36
+
### RLS behavior
37
+
38
+
If Row-Level Security (RLS) is enabled, your backend automatically injects a `$match` stage at the beginning of your pipeline (or after `$geoNear` / `$search` if present). This ensures users only aggregate data they have access to.
39
+
40
+
### Response fields
41
+
42
+
<ResponseFieldname="success"type="boolean">
43
+
`true` when the aggregation was executed successfully.
Copy file name to clipboardExpand all lines: mintlify/docs/api-reference/data/delete.mdx
+19-13Lines changed: 19 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,17 @@
1
1
---
2
2
title: "Delete Document"
3
-
description: "Permanently delete a document from a collection by its ID."
3
+
description: "Soft delete a document from a collection by its ID. Moves it to the trash."
4
4
---
5
5
6
6
## DELETE `/api/data/:collectionName/:id`
7
7
8
-
Permanently removes the document with the given ID from the collection. This operation cannot be undone.
8
+
Moves the document with the given ID to the trash by setting `isDeleted: true` and recording the `deletedAt` timestamp. The document remains recoverable for a **30-day grace period**, after which it is permanently deleted by a background cleanup worker. See the [Database Guide](/guides/database#soft-delete-trash) for more details.
9
9
10
-
### Required Header
10
+
### Required header
11
11
12
12
`x-api-key`: `sk_live_…` by default. `pk_live_…` is accepted only when the collection has **RLS enabled** and the request includes `Authorization: Bearer <accessToken>`.
The name of the collection containing the document.
@@ -21,21 +21,25 @@ Permanently removes the document with the given ID from the collection. This ope
21
21
The MongoDB ObjectId string of the document to delete.
22
22
</ParamField>
23
23
24
-
### RLS Ownership Check
24
+
### RLS ownership check
25
25
26
-
When using `pk_live` with RLS enabled, urBackend compares the existing document's owner field against the authenticated user's ID. Users can only delete their own documents — attempting to delete another user's document returns `403`.
26
+
When using `pk_live` with RLS enabled, urBackend compares the existing document's owner field against the authenticated user's ID. You can only delete your own documents; attempting to delete another user's document returns `403`.
27
27
28
-
### Response Fields
28
+
### Response fields
29
29
30
30
<ResponseFieldname="success"type="boolean">
31
-
`true` when the document was deleted.
31
+
`true` when the document was moved to trash.
32
+
</ResponseField>
33
+
34
+
<ResponseFieldname="data"type="object">
35
+
Object containing the `id` of the deleted document.
0 commit comments