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

CleanupOrphaned(데이터베이스 명령)

중요

MongoDB 6.0.3부터는 $shardedDataDistribution 단계를 통해 집계를 실행하여 고아 문서가 남아 있지 않은지 확인해야 합니다. 자세한 내용은 고아 문서가 남아 있지 않은지 확인을 참조하세요.

cleanupOrphaned

이 명령을 사용하면 샤드 키의 MinKey 부터 MaxKey 까지의 청크 범위 에 있는 고아 문서가 지정된 네임스페이스 가 샤드 멤버 과반수에서 정리될 때까지 기다립니다.

cleanupOrphaned 실행 하려면 admin 데이터베이스 에서 mongod 를 샤드 의 프라이머리 복제본 세트 멤버인 인스턴스 에서 직접 실행합니다. 를 실행 전에 밸런서 비활성화할 cleanupOrphaned 필요가 없습니다.

참고

인스턴스 에서 cleanupOrphaned mongos를 실행 하지 마세요.

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

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

중요

이 명령은 M0 및 Flex 클러스터에서 지원되지 않습니다. 자세한 내용은 지원되지 않는 명령을 참조하세요.

명령은 다음과 같은 구문을 가집니다:

db.runCommand(
{
cleanupOrphaned: "<database>.<collection>",
startingFromKey: <minimumShardKeyValue>, // deprecated
secondaryThrottle: <boolean>, // deprecated
writeConcern: <document> // deprecated
}
)

cleanupOrphaned 에는 다음과 같은 필드가 있습니다:

필드
유형
설명

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 권한이 있어야 합니다.

cleanupOrphaned 명령은 다음 필드의 하위 집합이 포함된 문서 반환합니다.

cleanupOrphaned.ok

성공하면 1 와(과) 같습니다.

1 값은 다음 중 하나를 나타냅니다.

  • 샤드의 cleanupOrphaned 네임스페이스에 고아 문서가 남아 있지 않습니다.

  • cleanupOrphaned 네임스페이스에서 참고된 collection은 샤딩되지 않습니다.

0 값은 오류가 발생했음을 나타냅니다.