← All procedures

mongo.database.info

Get database information and statistics

MCPCLI
Package
@procedures/mongo · README
Path
["mongo","database","info"]
CLI
mark mongo database info
MCP tool
mongo.database.info on the dev-tools server
As data
{"$proc":["mongo","database","info"],"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","database","info"], {});
console.log(JSON.stringify(result));

From the command line

$ mark mongo database info

As data, in a program

{ "$proc": ["mongo", "database", "info"], "input": {} }

Input

FieldTypeRequiredDefaultDescription
collectionstringnoThe collection name. It takes the place of metadata.collection.
databasestringnoThe database name (default: the database of the connection)

Output

FieldTypeRequiredDefaultDescription
namestringyesThe database name
collectionsnumberyesThe number of collections (views not counted)
viewsnumberyesThe number of views
sizeOnDisknumberyesThe data size, in bytes
emptybooleanyesTrue when the database has no collections
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": {
      "name": {
        "type": "string",
        "description": "The database name"
      },
      "collections": {
        "type": "number",
        "description": "The number of collections (views not counted)"
      },
      "views": {
        "type": "number",
        "description": "The number of views"
      },
      "sizeOnDisk": {
        "type": "number",
        "description": "The data size, in bytes"
      },
      "empty": {
        "type": "boolean",
        "description": "True when the database has no collections"
      }
    },
    "required": [
      "name",
      "collections",
      "views",
      "sizeOnDisk",
      "empty"
    ],
    "additionalProperties": {}
  }
}