TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/tutosrive/fastapi-CRUD-MongoDB/llms.txt
Use this file to discover all available pages before exploring further.
DELETE /tasks/{id} endpoint permanently removes a task document from the MongoDB task collection. The controller uses find_one_and_delete({'_id': ObjectId(id)}) which atomically finds and deletes the document in a single operation. On success it returns a FastAPI Response with HTTP status 204 No Content and an empty body. If no document matches the given id, the server raises an HTTPException with status 404 and the detail "Task Not Found!". This operation is irreversible — there is no soft-delete or recovery mechanism.
DELETE /tasks/{id}
Path Parameters
MongoDB ObjectId expressed as a 24-character hex string (e.g.
64a1b2c3d4e5f6789abcde01) identifying the task to delete.Example Request
Example Response
The response body is intentionally empty on success. A
204 No Content status code confirms the task was found and deleted. Do not expect a JSON payload in the response.Error Responses
| Status | Detail | Cause |
|---|---|---|
404 Not Found | "Task Not Found!" | No task document exists in MongoDB with the provided id, or it was already deleted. |
500 Internal Server Error | Server error message | Database connection failure or malformed ObjectId string. |