Database Manual / Reference / mongosh Methods / Databases

db.printCollectionStats() (mongosh method方法)

db.printCollectionStats()

Provides a wrapper around the db.collection.stats() method. Returns statistics from every collection separated by three hyphen characters.db.collection.stats()方法提供包装。返回由三个连字符分隔的每个集合的统计信息。

Note

The db.printCollectionStats() method run in mongosh does not return JSON. mongosh中运行的db.printCollectionStats()方法不返回JSON。Use db.printCollectionStats() for manual inspection, and db.collection.stats() in scripts.使用db.printCollectionStats()进行手动检查,在脚本中使用db.collection.stats()

Compatibility兼容性

This method is available in deployments hosted in the following environments:此方法在以下环境中托管的部署中可用:

  • MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud:云中MongoDB部署的完全托管服务

Note

This command is supported in all MongoDB Atlas clusters. 所有MongoDB Atlas集群都支持此命令。For information on Atlas support for all commands, see Unsupported Commands.有关Atlas支持所有命令的信息,请参阅不支持的命令

  • MongoDB Enterprise: The subscription-based, self-managed version of MongoDB:MongoDB的基于订阅的自我管理版本
  • MongoDB Community: The source-available, free-to-use, and self-managed version of MongoDB:MongoDB的源代码可用、免费使用和自我管理版本