Delete

Use delete() to remove a document from a collection using its _id.

Maps to DELETE /:collection/docs/:id. On success the API returns a confirmation payload.

🗑️ delete()

await db.users.delete("user_jianyang");

This deletes the document with _id: "user_jianyang" from the users collection.

Behavior

  • If the document exists, it is deleted permanently.
  • If it does not exist, it throws a 404 error.
// Typical success response shape
{ "message": "Document deleted" }