Join us Sept 17 at .local NYC! Use code WEB50 to save 50% on tickets. Learn more >
MongoDB Event
Docs Menu
Docs Home
/ /
Atlas CLI
/ / / /

Atlas cluster 인덱스 생성

프로젝트에 지정된 cluster에 대한 롤링 인덱스를 생성합니다.

공개 미리 보기: MongoDB Atlas 관리자 API 에서 자동으로 생성된 Atlas API 하위 명령은 관리자 API 에 대한 전체 범위를 제공하며 현재 공개 미리 보기로 제공됩니다( 피드백 https:// 피드백.mongodb.com/에서 제공하세요. 포럼/930808-Atlas-cli). 관리자 API 기능에는 자체 출시하다 수명 주기가 있으며, 이는 제공된 API 엔드포인트 문서 링크를 통해 확인할 수 있습니다.

이 명령을 사용하려면 프로젝트 데이터 액세스 관리자 역할이 있는 사용자 계정 또는 API 키로 인증해야 합니다.

명령 구문
atlas clusters indexes create [indexName] [options]
이름
유형
필수 사항
설명

indexName

문자열

거짓

인덱스의 이름입니다.

이름
유형
필수 사항
설명

--clusterName

문자열

true

--collection

문자열

거짓

컬렉션의 이름입니다.

--file과 상호 배타적입니다.

--db

문자열

거짓

데이터베이스의 이름입니다.

--file과 상호 배타적입니다.

-f, --file

문자열

거짓

인덱스 설정을 정의하는 선택적 JSON 구성 파일 의 경로입니다. 참고: JSON 파일 에서 지원되지 않는 필드는 무시됩니다.

--db, --collection, --key와 상호 배타적입니다.

-h, --help

거짓

만들기 도움말

--key

strings

거짓

인덱싱할 필드와 인덱스 유형을 필드:유형 형식으로 입력합니다.

--file과 상호 배타적입니다.

--projectId

문자열

거짓

사용할 프로젝트를 식별하는 16진수 문자열입니다. 이 옵션은 구성 파일 또는 환경 변수의 설정을 재정의합니다.

--sparse

거짓

희소 인덱스 생성하는 플래그입니다. 자세한 학습 은 https://dochub.mongodb.org/core/index-sparse-manual을 참조하세요.

이름
유형
필수 사항
설명

-P, --profile

문자열

거짓

구성 파일 에서 사용할 프로필의 이름입니다. Atlas CLI 의 프로필에 대해 학습 https://dochub.mongodb.org/core/atlas-cli-save-connection-settings를 참조하세요.

# Create an index named bedrooms_1 on the listings collection of the realestate database:
atlas clusters indexes create bedrooms_1 --clusterName Cluster0 --collection listings --db realestate --key bedrooms:1
# Create a compound index named property_room_bedrooms on the
listings collection of the realestate database:
atlas clusters indexes create property_room_bedrooms --clusterName Cluster0 --collection listings --db realestate --key property_type:1 --key room_type:1 --key bedrooms:1
# Create an index named my_index from a JSON configuration file named myfile.json:
atlas clusters indexes create my_index --clusterName Cluster0 --file file.json

이 페이지의 내용