# db.collection.totalIndexSize()

* `db.collection.` `totalIndexSize` ()

|     |                                                         |
| --- | ------------------------------------------------------- |
| 返回： | 集合的所有索引的总大小。 如果索引使用前缀压缩(即WiredTiger 的默认值)，则返回的大小反映压缩大小。 |

此方法在collStats(即：db.collection.stats())操作的totalIndexSize输出周围提供包装。

译者：李冠飞

校对：


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mongoing.com/can-kao/mongo-shell-methods/collection-methods/db-collection-totalindexsize.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
