컬렉션에서 단일 문서를 업데이트합니다.
연결된 MongoDB Atlas 데이터 소스의 이름입니다. 이는 일반적으로 "mongodb-atlas"이지만 데이터 소스를 생성할 때 다른 이름을 선택한 경우 앱에서 해당 이름이 다를 수 있습니다.
지정된 데이터 소스에 있는 데이터베이스의 이름입니다.
지정된 데이터베이스에 있는 컬렉션의 이름입니다.
문서와 일치하는 MongoDB 쿼리 필터입니다. 데이터 API가 지원하는 모든 쿼리 작업자 목록은 쿼리 작업자를 참조하세요.
일치하는 문서에 적용할 MongoDB 업데이트 표현식입니다. 데이터 API가 지원하는 모든 업데이트 연산자 목록은 업데이트 연산자를 참조하세요.
true인 경우 업데이트 필터가 기존 문서와 일치하지 않으면 필터 및 지정된 업데이트 작업을 기반으로 새 문서를 삽입합니다.
기본값은 false 입니다.
연결된 MongoDB Atlas 데이터 소스의 이름입니다. 이는 일반적으로 "mongodb-atlas"이지만 데이터 소스를 생성할 때 다른 이름을 선택한 경우 앱에서 해당 이름이 다를 수 있습니다.
지정된 데이터 소스에 있는 데이터베이스의 이름입니다.
지정된 데이터베이스에 있는 컬렉션의 이름입니다.
문서와 일치하는 MongoDB 쿼리 필터입니다. 데이터 API가 지원하는 모든 쿼리 작업자 목록은 쿼리 작업자를 참조하세요.
일치하는 문서에 적용할 MongoDB 업데이트 표현식입니다. 데이터 API가 지원하는 모든 업데이트 연산자 목록은 업데이트 연산자를 참조하세요.
true인 경우 업데이트 필터가 기존 문서와 일치하지 않으면 필터 및 지정된 업데이트 작업을 기반으로 새 문서를 삽입합니다.
기본값은 false 입니다.
curl -s "https://data.mongodb-api.com/app/$CLIENT_APP_ID/endpoint/data/v1/action/updateOne" \
-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": "64224f4d089104f1766116a5" }
},
"update": {
"$set": {
"status": "complete",
"completedAt": { "$date": { "$numberLong": "1680105272788" } }
}
}
}'
{
"filter": {
"_id": {
"$oid": "642f1bb5cee4111898828bf6"
}
},
"update": {
"$set": {
"status": "complete"
}
},
"upsert": false,
"database": "todo",
"collection": "tasks",
"dataSource": "mongodb-atlas"
}
{
"filter": {
"_id": {
"$oid": "642f1bb5cee4111898828bf6"
}
},
"update": {
"$set": {
"status": "complete"
}
},
"upsert": false,
"database": "todo",
"collection": "tasks",
"dataSource": "mongodb-atlas"
}
{
"matchedCount": 1,
"modifiedCount": 1
}
{
"matchedCount": {
"$numberInt": "1"
},
"modifiedCount": {
"$numberInt": "1"
}
}
{
"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"
}
{
"error": "invalid session: error finding user for endpoint",
"error_code": "InvalidSession",
"link": "string"
}