Skip to main content
This page shows you how to use the delete endpoint to remove documents from a collection. The examples delete from the default branch, main. To delete from another existing writable branch, include its name in the REST request’s optional branch field. A tag or alias is not a valid write target. See Branch selection. Specify exactly one of ids or filter. An empty request, both fields together, or partitionFilter alone returns 400 BadRequest. For partitioned collections, partitionFilter narrows the IDs or filter selection; it is not an independent deletion selector.

Delete documents by IDs

Since LambdaDB documents can always be efficiently accessed using their ID, deleting by ID is the most efficient way to remove specific records.

Delete documents by query

To delete documents based on their data, pass a filter query to the delete operation. This deletes all documents matching the filter query. For example, to delete all documents with genre “documentary” and year 2019 from a collection, use the following code: These snippets reuse the imports, client setup, and cURL variables above. For Go, replace the ID-deletion call inside main with the filter example below.

Delete an entire collection

To remove all documents from a collection, delete the collection and recreate it. The delete operation makes the logical collection unavailable before returning 200 OK, so the same collection name can be reused immediately.