On this page本页内容
dataSize
The dataSize
command returns the size in bytes for the specified data:dataSize
命令返回指定数据的大小(以字节为单位):
{ dataSize: <string>, keyPattern: <document>, min: <document>, max: <document>, estimate: <boolean> }
The command takes the following fields:该命令接受以下字段:
dataSize | string | |
keyPattern | document |
|
min | document | |
max | document | |
estimate | boolean |
|
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}
.dataSize
集合上运行dataSize
命令,指定键模式{field: 1}
,要检查的键范围的下限为{field: 10}
,而要检查的密钥的上限为{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.database.collection
替换为部署中的数据库和集合。
The amount of time required to return 返回dataSize
depends on the amount of data in the collection.dataSize
所需的时间取决于集合中的数据量。