对于 AI 代理:可在 https://www.mongodb.com/zh-cn/docs/llms.txt 获取文档索引—通过在任何 URL 路径后添加 .md 可获取所有页面的 Markdown 版本。
Docs 菜单

db. 集合.totalIndexSize()(mongosh方法)

重要

mongosh 方法

This page documents a mongosh method. This is not the documentation for database commands or language-specific drivers, such as Node.js.

对于数据库命令,请参阅 collStats 命令返回的 totalIndexSize 字段。

如需了解 MongoDB API 驱动程序,请参阅特定语言的 MongoDB 驱动程序文档。

db.collection.totalIndexSize()
返回:

集合中所有索引的总大小。

如果索引使用了前缀压缩(即 default for WiredTiger),返回的大小将反映压缩后的大小。

要在副本集成员上运行,collStats 操作需要成员处于 PRIMARY 或 SECONDARY 状态。如果节点处于其他状态,如 STARTUP2,则操作错误。

此方法可用于以下环境中托管的部署:

  • MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud

注意

This command is supported in all MongoDB Atlas clusters. For information on Atlas support for all commands, see Unsupported Commands.

给本页内容打分

在此页面上