Docs Menu
Docs Home
/ /
Atlas CLI
/ / /

Atlas cluster 인덱스 생성

이 페이지의 내용

  • 구문
  • arguments
  • 옵션
  • 상속된 옵션
  • 예제

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

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

명령 구문
atlas clusters indexes create [indexName] [options]
이름
유형
필수 사항
설명
indexName
문자열
거짓
인덱스의 이름입니다.
이름
유형
필수 사항
설명
--clusterName
문자열
true
클러스터의 이름입니다. 자세한 내용은 https://dochub.mongodb.org/core/create-cluster-api를 참조하세요.
--collection
문자열
거짓

컬렉션의 이름입니다.

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

--db
문자열
거짓

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

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

-f, --file
문자열
거짓

인덱스 설정을 정의하는 선택적 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

돌아가기

인덱스