reIndex
정의
reIndex
버전 6.0부터 더 이상 사용되지 않습니다.
Attempting to run the
reIndex
command writes a warning message to the log.팁
mongosh
에서 이 명령을db.collection.reIndex()
헬퍼 메서드를 통해서도 실행할 수 있습니다.헬퍼 메서드는
mongosh
사용자에게 편리하지만 데이터베이스 명령과 동일한 수준의 정보를 반환하지 못할 수 있습니다. 편의가 필요하지 않거나 추가 리턴 필드가 필요한 경우 데이터베이스 명령을 사용합니다.The
reIndex
command drops all indexes on a collection and recreates them. This operation may be expensive for collections that have a large amount of data and/or a large number of indexes.
호환성
이 명령은 다음 환경에서 호스팅되는 배포에서 사용할 수 있습니다.
MongoDB Enterprise: MongoDB의 구독 기반 자체 관리 버전
MongoDB Community: MongoDB의 소스 사용 가능 무료 자체 관리 버전
중요
이 명령은 MongoDB Atlas 클러스터에서 지원되지 않습니다. 모든 명령에 대한 Atlas 지원 에 대한 자세한 내용은 지원되지 않는 명령을 참조하세요.
구문
명령은 다음과 같은 구문을 가집니다:
db.runCommand( { reIndex: <collection> } )
명령 필드
이 명령은 다음 필드를 사용합니다.
필드 | 설명 |
---|---|
reIndex | The name of the collection to reindex. |
행동
For MongoDB 5.0 or later, reIndex
may only be run on
독립형 instances.
리소스 잠금
reIndex
obtains an exclusive (W) lock on the collection and blocks
other operations on the collection until it completes.
MongoDB 잠금에 대한 자세한 내용은 FAQ: 동시성을 참조하세요.
팁
참조:
채워진 컬렉션을 기반으로 하는 인덱스 빌드 for more information on the behavior of indexing operations in MongoDB.