POST / 动作/updateMany
curl -s "https://data.mongodb-api.com/app/$CLIENT_APP_ID/endpoint/data/v1/action/updateMany" \
-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": {
"status": "open"
},
"update": {
"$set": {
"status": "complete",
"completedAt": { "$date": { "$numberLong": "1680105287069" } }
}
}
}'
请求示例
{
"filter": {
"status": "open"
},
"update": {
"$set": {
"status": "complete"
}
},
"database": "todo",
"collection": "tasks",
"dataSource": "mongodb-atlas"
}
请求示例
{
"filter": {
"status": "open"
},
"update": {
"$set": {
"status": "complete"
}
},
"database": "todo",
"collection": "tasks",
"dataSource": "mongodb-atlas"
}
响应示例 (200)
{
"matchedCount": 12,
"modifiedCount": 12
}
响应示例 (200)
{
"matchedCount": {
"$numberInt": "12"
},
"modifiedCount": {
"$numberInt": "12"
}
}
响应示例 (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"
}