중요
MongoDB 6.0.3부터는 $shardedDataDistribution 단계를 통해 집계를 실행하여 고아 문서가 남아 있지 않은지 확인해야 합니다. 자세한 내용은 고아 문서가 남아 있지 않은지 확인을 참조하세요.
정의
cleanupOrphaned이 명령을 사용하면 샤드 키의
MinKey부터MaxKey까지의 청크 범위 에 있는 고아 문서가 지정된 네임스페이스 가 샤드 멤버 과반수에서 정리될 때까지 기다립니다.cleanupOrphaned실행 하려면admin데이터베이스 에서mongod를 샤드 의 프라이머리 복제본 세트 멤버인 인스턴스 에서 직접 실행합니다. 를 실행 전에 밸런서 비활성화할cleanupOrphaned필요가 없습니다.참고
인스턴스 에서
cleanupOrphanedmongos를 실행 하지 마세요.
호환성
이 명령은 다음 환경에서 호스팅되는 배포에서 사용할 수 있습니다.
- MongoDB Atlas: 클라우드에서의 MongoDB 배포를 위한 완전 관리형 서비스
중요
이 명령은 M0 및 Flex 클러스터에서 지원되지 않습니다. 자세한 내용은 지원되지 않는 명령을 참조하세요.
MongoDB Enterprise: MongoDB의 구독 기반 자체 관리 버전
MongoDB Community: MongoDB의 소스 사용 가능 무료 자체 관리 버전
구문
명령은 다음과 같은 구문을 가집니다:
db.runCommand( { cleanupOrphaned: "<database>.<collection>", startingFromKey: <minimumShardKeyValue>, // deprecated secondaryThrottle: <boolean>, // deprecated writeConcern: <document> // deprecated } )
명령 필드
cleanupOrphaned 에는 다음과 같은 필드가 있습니다:
필드 | 유형 | 설명 |
|---|---|---|
| 문자열 | 분할된 데이터가 정리될 때까지 기다릴 collection의 네임스페이스, 즉 데이터베이스와 collection 이름입니다. |
행동
범위 결정
The value of this field is not used to determine the bounds of the cleanup range. The cleanupOrphaned command waits until all orphaned documents in all ranges in the namespace are cleaned up from the shard before completing, regardless of the presence of or value of startingFromKey.
필요한 액세스 권한
로 실행 시스템에서 를 authorization 실행 하려면 clusterAdmin cleanupOrphaned 권한이 있어야 합니다.
출력
returnDocument
각 cleanupOrphaned 명령은 다음 필드의 하위 집합이 포함된 문서 반환합니다.