AI 에이전트의 경우: 문서 인덱스는 https://www.mongodb.com/ko-kr/docs/llms.txt에서 사용할 수 있으며, 모든 페이지의 마크다운 버전은 어떤 URL 경로에 .md를 추가하여 사용할 수 있습니다.
Docs Menu

db. 컬렉션.getIndexes() (mongosh 메서드)

드라이버가 포함된 MongoDB

This page documents a mongosh method. To see the equivalent method in a MongoDB driver, see the corresponding page for your programming language:
db.collection.getIndexes()

숨겨진 인덱스와 현재 빌드 중인 인덱스를 포함하여 컬렉션 의 기존 인덱스를 식별하고 설명하는 문서 목록이 포함된 배열 반환합니다.

You must call db.collection.getIndexes() on a collection. For example:

db.collection.getIndexes()

collection을 인덱스 정보를 반환할 collection의 이름으로 변경합니다.

이 메서드는 다음 환경에서 호스팅되는 배포에서 사용할 수 있습니다.

  • MongoDB Atlas: 클라우드에서의 MongoDB 배포를 위한 완전 관리형 서비스

참고

이 명령은 모든 MongoDB Atlas 클러스터에서 지원됩니다. 모든 명령에 대한 Atlas 지원에 관해 자세히 알아보려면 지원되지 않는 명령을 참조하세요.

getIndexes() does not return information on Atlas Search indexes. For information on Atlas Search indexes, use $listSearchIndexes.

If the client that issued db.collection.getIndexes() disconnects before the operation completes, MongoDB marks db.collection.getIndexes() for termination using killOp.

복제본 세트 노드에서 실행하는 경우 listIndexes 연산을 수행하려면 노드가 PRIMARY 또는 SECONDARY 상태여야 합니다. 노드가 STARTUP2와 같은 다른 상태이면 연산 오류가 발생합니다.

MongoDB 6.3, 6.0.5 및 5.0.16부터 wildcardProjection 필드는 인덱스 프로젝션을 제출된 형식으로 저장합니다. 이전 버전의 서버에서는 프로젝션을 정규화된 형태로 저장했을 수 있습니다.

The server uses the index the same way, but you may notice a difference in the output of the listIndexes and db.collection.getIndexes() commands.

To run db.collection.getIndexes() when access control is enforced, users must have privileges to listIndexes on the collection.

The built-in role read provides the required privileges to run db.collection.getIndexes() for the collections in a database.

db.collection.getIndexes() 컬렉션에 대한 인덱스 정보를 담고 있는 문서 배열을 반환합니다. 예시:

[
{
"v" : 2,
"key" : {
"_id" : 1
},
"name" : "_id_"
},
{
"v" : 2,
"key" : {
"status" : 1
},
"name" : "status_1"
},
{
"v" : 2,
"key" : {
"points" : 1
},
"name" : "points_1"
}
]

인덱스 정보에는 인덱스 생성에 사용된 키와 옵션이 포함됩니다. 인덱스 옵션 hidden은 값이 true인 경우에만 사용할 수 있습니다.

키 및 인덱스 옵션에 대한 자세한 내용은 db.collection.createIndex()을(를) 참조하세요.

이 페이지 평가하기