데이터 크기
정의
dataSize
The
dataSize
command returns the size in bytes for the specified data.
호환성
이 명령은 다음 환경에서 호스팅되는 배포에서 사용할 수 있습니다.
MongoDB Atlas: 클라우드에서의 MongoDB 배포를 위한 완전 관리형 서비스
중요
이 명령은 M0, M2, M5 및 Flex 클러스터에서 지원되지 않습니다. 자세한 내용은 지원되지 않는 명령을 참조하세요.
MongoDB Enterprise: MongoDB의 구독 기반 자체 관리 버전
MongoDB Community: MongoDB의 소스 사용 가능 무료 자체 관리 버전
구문
명령은 다음과 같은 구문을 가집니다:
db.runCommand( { dataSize: <string>, keyPattern: <document>, min: <document>, max: <document>, estimate: <boolean> } )
명령 필드
이 명령은 다음 필드를 사용합니다.
필드 | 유형 | 설명 |
---|---|---|
| 문자열 | 대상 컬렉션의 이름입니다. |
| 문서 | Optional. The collection's key pattern to examine. The collection must have an index with the corresponding pattern.
Otherwise |
| 문서 | Optional. The lower bound of the key range to be examined. |
| 문서 | Optional. The upper bound of the key range to be examined. |
| 부울 | Optional. When Defaults to false. |
예시
The following operation runs the dataSize
command on the
database.collection
collection, specifying a key pattern of {field: 1}
with the lower bound of the range of keys to be examined being {field: 10}
and the upper bound of the key to be examined being {field: 100}
.
db.runCommand({ dataSize: "database.collection", keyPattern: { field: 1 }, min: { field: 10 }, max: { field: 100 } })
This returns a document with the size in bytes for all matching
documents. Replace database.collection
with the database and
collection from your deployment.
The amount of time required to return dataSize
depends on the
amount of data in the collection.