Main Operations
Delete

Delete

CapybaraDB supports deletion of documents using operations similar to MongoDB. You can delete one or multiple documents by specifying filters. This guide explains how to perform delete operations.

Delete Operation

The delete operation is used to delete one or multiple documents in a collection based on a filter.

Example Python Code for delete

Here’s how you can delete documents by applying a filter:

Python
# Filter to match the document(s) to delete
filter_criteria = {
    "email": "johndoe@example.com"
}
 
response = collection.delete(filter_criteria)

Delete Response

A successful delete operation will return a JSON response indicating the number of deleted documents:

{
  "deleted_count": 1 // the count of deleted documents
}

Parameters for Delete Operations

ParameterDescription
filterA query object to match the documents to delete. This works the same way as MongoDB filters, where you specify conditions to find the documents that need to be deleted. For more details, refer to the filter operator syntax.

How can we improve this documentation?

Got question? Email us