온라인 아카이브 한 개를 생성합니다. 이 아카이브는 프로젝트 한 개 내에 클러스터 한 개의 데이터를 저장합니다. 이 리소스를 사용하려면, 요청하는 서비스 계정 또는 API 키에 프로젝트 데이터 액세스 관리자 역할이 있어야 합니다.
프로젝트 식별하는 고유한 24-16진수 문자열입니다. 인증된 사용자가 액세스 할 수 있는 모든 프로젝트를 조회 하려면 /groups 엔드포인트를 사용합니다.
참고: 그룹과 프로젝트는 동의어입니다. 그룹 ID는 프로젝트 ID와 동일합니다. 기존 그룹의 경우, 그룹/프로젝트 ID는 동일하게 유지됩니다. 리소스 및 해당 엔드포인트는 그룹이라는 용어를 사용합니다.
형식은 ^([a-f0-9]{24})$ 패턴 과 일치해야 합니다.
온라인 아카이브 한 개를 생성하려는 컬렉션이 포함된 cluster를 식별하는 사람이 읽을 수 있는 레이블입니다.
형식은 ^[a-zA-Z0-9][a-zA-Z0-9-]*$ 패턴 과 일치해야 합니다.
애플리케이션이 응답을 envelope JSON 객체로 래핑할지 여부를 나타내는 플래그입니다. 일부 API 클라이언트는 HTTP 응답 헤더 또는 상태 코드에 액세스할 수 없습니다. 이 문제를 해결하려면 쿼리에서 envelope=true를 설정합니다. 결과 목록을 반환하는 엔드포인트는 결과 객체를 엔벨로프로 사용합니다. 애플리케이션은 응답 본문에 상태 매개변수를 추가합니다.
기본값은 false 입니다.
응답 본문이 프리티프린트 형식이어야 하는지 여부를 나타내는 플래그입니다.
기본값은 false 입니다.
온라인 아카이브 한 개를 생성합니다.
온라인 아카이브를 생성한 컬렉션을 식별하는 사람이 읽을 수 있는 레이블입니다.
반환하려는 MongoDB 데이터베이스 컬렉션의 분류입니다.
이 매개변수를 TIMESERIES(으)로 설정하는 경우 "criteria.type" : "date" 및 "criteria.dateFormat" : "ISODATE"을(를) 설정합니다.
값은 TIMESERIES 또는 STANDARD입니다. 기본값은 STANDARD입니다.
아카이브에서 데이터를 삭제해야 하는 시기를 지정하는 규칙입니다.
온라인 아카이브가 포함된 컬렉션이 포함된 데이터베이스의 사람이 읽을 수 있는 레이블입니다.
최대 길이는 64입니다.
컬렉션 내에서 데이터를 논리적으로 나누는 데 사용할 문서 매개변수가 포함된 목록입니다. 파티션은 기본 컬렉션 데이터에 대한 대략적인 수준의 필터링 기능을 제공합니다. 데이터를 분할하려면 자주 쿼리하는 매개변수를 지정합니다. 'specified :criteria.type'(이)라면 CREATE ONE ONLINE ARCHIVE 엔드포인트에 'DATE'를 입력한 다음 쿼리할 매개변수를 최대 세 개까지 지정할 수 있습니다. 이러한 매개변수 중 한 개는 DATE 값이어야 합니다.(이 경우 필수) 'specified :criteria.type'(이)라면 CREATE ONE ONLINE ARCHIVE 엔드포인트에 'CUSTOM'을 입력한 다음 쿼리할 매개변수를 최대 두 개까지 지정할 수 있습니다. ':criteria.type': 'DATE' 또는 ':criteria.type': 'CUSTOM' 매개변수를 사용하지 않는 쿼리는 MongoDB가 모든 보관 문서의 전체 컬렉션을 스캔하게 합니다. 이렇게 하면 시간이 더 걸리고 비용도 증가합니다.
이 온라인 아카이브를 분할할 메타데이터입니다.
요소가 1 개 이상이어야 합니다.
이 온라인 아카이브가 일시 중지된 상태로 있는지 여부를 나타내는 플래그입니다. 컬렉션에 다른 활성 온라인 아카이브가 있는 경우 재개 요청은 실패합니다. 활성 온라인 아카이브를 일시 중지하거나 일시 중지된 온라인 아카이브를 재개하려면 이 매개변수를 포함해야 합니다. 활성 아카이브를 일시 중지하려면 이를 true로 설정합니다. 일시 중지된 아카이브를 재개하려면 이를 false로 설정합니다.
atlas api onlineArchive createOnlineArchive --help
import (
"os"
"context"
"log"
sdk "go.mongodb.org/atlas-sdk/v20250312001/admin"
)
func main() {
ctx := context.Background()
clientID := os.Getenv("MONGODB_ATLAS_CLIENT_ID")
clientSecret := os.Getenv("MONGODB_ATLAS_CLIENT_SECRET")
// See https://dochub.mongodb.org/core/atlas-go-sdk-oauth
client, err := sdk.NewClient(sdk.UseOAuthAuth(clientID, clientSecret))
if err != nil {
log.Fatalf("Error: %v", err)
}
params = &sdk.CreateGroupClusterOnlineArchiveApiParams{}
sdkResp, httpResp, err := client.OnlineArchiveApi.
CreateGroupClusterOnlineArchiveWithParams(ctx, params).
Execute()
}
curl --include --header "Authorization: Bearer ${ACCESS_TOKEN}" \
--header "Accept: application/vnd.atlas.2025-03-12+json" \
--header "Content-Type: application/json" \
-X POST "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/onlineArchives" \
-d '{ <Payload> }'
curl --user "${PUBLIC_KEY}:${PRIVATE_KEY}" \
--digest --include \
--header "Accept: application/vnd.atlas.2025-03-12+json" \
--header "Content-Type: application/json" \
-X POST "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/onlineArchives" \
-d '{ <Payload> }'
{
"collName": "string",
"collectionType": "STANDARD",
"criteria": {
"type": "CUSTOM",
"query": "string"
},
"dataExpirationRule": {
"expireAfterDays": 42
},
"dataProcessRegion": {
"cloudProvider": "AWS",
"region": "US_EAST_1"
},
"dbName": "string",
"partitionFields": [
{
"fieldName": "string",
"order": 0
}
],
"paused": true,
"schedule": {
"type": "DEFAULT"
}
}
{
"_id": "32b6e34b3d91647abb20e7b8",
"clusterName": "string",
"collName": "string",
"collectionType": "STANDARD",
"criteria": {
"type": "CUSTOM",
"query": "string"
},
"dataExpirationRule": {
"expireAfterDays": 42
},
"dataProcessRegion": {
"cloudProvider": "AWS",
"region": "US_EAST_1"
},
"dataSetName": "string",
"dbName": "string",
"groupId": "32b6e34b3d91647abb20e7b8",
"partitionFields": [
{
"fieldName": "string",
"fieldType": "date",
"order": 0
}
],
"paused": true,
"schedule": {
"type": "DEFAULT"
},
"state": "PENDING"
}
{
"error": 400,
"detail": "(This is just an example, the exception may not be related to this endpoint) No provider AWS exists.",
"reason": "Bad Request",
"errorCode": "VALIDATION_ERROR"
}
{
"error": 401,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Unauthorized",
"errorCode": "NOT_ORG_GROUP_CREATOR"
}
{
"error": 403,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Forbidden",
"errorCode": "CANNOT_CHANGE_GROUP_NAME"
}
{
"error": 404,
"detail": "(This is just an example, the exception may not be related to this endpoint) Cannot find resource AWS",
"reason": "Not Found",
"errorCode": "RESOURCE_NOT_FOUND"
}
{
"error": 409,
"detail": "(This is just an example, the exception may not be related to this endpoint) Cannot delete organization link while there is active migration in following project ids: 60c4fd418ebe251047c50554",
"reason": "Conflict",
"errorCode": "CANNOT_DELETE_ORG_ACTIVE_LIVE_MIGRATION_ATLAS_ORG_LINK"
}
{
"error": 500,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Internal Server Error",
"errorCode": "UNEXPECTED_ERROR"
}