删除单个文档
DELETE/collections/:collectionName/documents/:docId
根据文档 _id 删除单个文档。使用标准的 RESTful DELETE 方法。如果文档不存在,返回 404。
Request
Path Parameters
collectionName stringrequired
集合名称
docId stringrequired
文档 ID(支持 ObjectId 字符串和普通字符串)
Query Parameters
transactionId string
事务 ID
Responses
- 200
- 404
删除成功
- application/json
- Schema
- Example (from schema)
- Example
Schema
deleted integer
删除的文档数量
{
"deleted": 0
}
{
"deleted": 1
}
文档不存在
- application/json
- Schema
- Example (from schema)
- Example
Schema
code string
错误码
message string
错误信息
request_id string
请求唯一 ID
{
"code": "INVALID_PARAM",
"message": "param.query can't be empty",
"request_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
{
"code": "DOCUMENT_NOT_FOUND",
"message": "Document not found",
"request_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
Loading...