CapyDB provides a straightforward way to delete documents from a collection using operations similar to MongoDB's delete functionality. You can delete one or multiple documents that match a specified filter.
The delete
operation allows you to remove documents from a collection that match a specified filter. This operation is permanent and cannot be undone.
delete
Here's how you can delete documents using Python:
# Filter to match the document(s) to delete
filter_criteria = {
"name": "Alice Smith"
}
# Sending the request
response = collection.delete(filter_criteria)
A successful delete operation will return a JSON response containing information about the number of documents deleted. Here's an example response:
{
"deleted_count": 1
}
Parameter | Description |
---|---|
filter | A query object to match the documents to delete. This works the same way as MongoDB filters, allowing you to specify conditions to find the documents. For more details, refer to the filter operator syntax. |
Your feedback helps us improve our documentation. Let us know what you think!