← All procedures

mongo.indexes.list

List indexes on a collection

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

From the command line

$ mark mongo indexes list

As data, in a program

{ "$proc": ["mongo", "indexes", "list"], "input": {} }

Input

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

Output

FieldTypeRequiredDefaultDescription
indexesobject[]yesThe indexes of the collection
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": {
      "indexes": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "description": "The index name"
            },
            "key": {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {
                "type": [
                  "number",
                  "string"
                ]
              },
              "description": "The fields of the index and their kind (1, -1, \"text\", \"hashed\")"
            },
            "unique": {
              "description": "True for a unique index",
              "type": "boolean"
            },
            "sparse": {
              "description": "True for a sparse index",
              "type": "boolean"
            }
          },
          "required": [
            "name",
            "key"
          ],
          "additionalProperties": {}
        },
        "description": "The indexes of the collection"
      }
    },
    "required": [
      "indexes"
    ],
    "additionalProperties": {}
  }
}