application/json
body
-
链接的 MongoDB Atlas 数据源的名称。它通常为
"mongodb-atlas"
,但如果您在创建数据源时选择了不同的名称,则在应用程序中可能具有不同的名称。 -
指定的数据源中的数据库名称。
-
指定的数据库中的集合名称。
-
匹配文档的 MongoDB 查询筛选条件。有关 Data API 支持的所有查询运算符的列表,请参阅查询运算符。
body
-
链接的 MongoDB Atlas 数据源的名称。它通常为
"mongodb-atlas"
,但如果您在创建数据源时选择了不同的名称,则在应用程序中可能具有不同的名称。 -
指定的数据源中的数据库名称。
-
指定的数据库中的集合名称。
-
匹配文档的 MongoDB 查询筛选条件。有关 Data API 支持的所有查询运算符的列表,请参阅查询运算符。
POST /动作/deleteOne
curl -s "https://data.mongodb-api.com/app/$CLIENT_APP_ID/endpoint/data/v1/action/deleteOne" \
-X POST \
-H "apiKey: $API_KEY" \
-H 'Content-Type: application/ejson' \
-H "Accept: application/json" \
-d '{
"dataSource": "mongodb-atlas",
"database": "learn-data-api",
"collection": "tasks",
"filter": {
"_id": { "$oid": "64224f3cd79f54ad342dd9b2" }
}
}'
请求示例
{
"filter": {
"text": "Do the dishes"
},
"database": "todo",
"collection": "tasks",
"dataSource": "mongodb-atlas"
}
请求示例
{
"filter": {
"text": "Do the dishes"
},
"database": "todo",
"collection": "tasks",
"dataSource": "mongodb-atlas"
}
响应示例 (200)
{
"deletedCount": 1
}
响应示例 (200)
{
"deletedCount": {
"$numberInt": 1
}
}
响应示例 (400)
Errornoauthenticationspecified
{
"error": "no authentication methods were specified",
"error_code": "InvalidParameter",
"link": "string"
}
{
"error": "must specify some form of authentication (either email+password, api-key, or jwt) in the request header or body",
"error_code": "MissingParameter",
"link": "string"
}
响应示例 (401)
{
"error": "invalid session: error finding user for endpoint",
"error_code": "InvalidSession",
"link": "string"
}