← All procedures
mongo.collections.stats
Get collection statistics
MCPCLI- Package
- @procedures/mongo · README
- Path
["mongo","collections","stats"]- CLI
mark mongo collections stats- MCP tool
mongo.collections.stats on the dev-tools server- As data
{"$proc":["mongo","collections","stats"],"input":{}}
Use it
In TypeScript
import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/mongo"; // registers its procedures
const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["mongo","collections","stats"], {});
console.log(JSON.stringify(result));From the command line
$ mark mongo collections stats
As data, in a program
{ "$proc": ["mongo", "collections", "stats"], "input": {} }Input
| Field | Type | Required | Default | Description |
|---|
collection | string | no | | The collection name. It takes the place of metadata.collection. |
database | string | no | | The database name (default: the database of the connection) |
Output
| Field | Type | Required | Default | Description |
|---|
count | number | yes | | The number of documents |
size | number | yes | | The size of the documents, in bytes |
avgObjSize | number | yes | | The average size of a document, in bytes |
storageSize | number | yes | | The storage size, in bytes |
nindexes | number | yes | | The number of indexes |
totalIndexSize | number | yes | | The size of the indexes, in bytes |
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"collection": {
"description": "The collection name. It takes the place of metadata.collection.",
"type": "string",
"minLength": 1
},
"database": {
"description": "The database name (default: the database of the connection)",
"type": "string",
"minLength": 1
}
}
},
"output": {
"type": "object",
"properties": {
"count": {
"type": "number",
"description": "The number of documents"
},
"size": {
"type": "number",
"description": "The size of the documents, in bytes"
},
"avgObjSize": {
"type": "number",
"description": "The average size of a document, in bytes"
},
"storageSize": {
"type": "number",
"description": "The storage size, in bytes"
},
"nindexes": {
"type": "number",
"description": "The number of indexes"
},
"totalIndexSize": {
"type": "number",
"description": "The size of the indexes, in bytes"
}
},
"required": [
"count",
"size",
"avgObjSize",
"storageSize",
"nindexes",
"totalIndexSize"
],
"additionalProperties": {}
}
}