← All procedures

mongo.collections.drop

Drop (delete) a collection

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

From the command line

$ mark mongo collections drop --confirm <boolean>

As data, in a program

{
  "$proc": ["mongo", "collections", "drop"],
  "input": { "confirm": true }
}

Input

FieldTypeRequiredDefaultDescription
collectionstringnoThe collection name. It takes the place of metadata.collection.
databasestringnoThe database name (default: the database of the connection)
confirmbooleanyesSet to true to drop the collection and all of its documents

Output

FieldTypeRequiredDefaultDescription
acknowledgedbooleanyesTrue when the server confirmed the write
droppedbooleanyesFalse when the collection did not exist
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
      },
      "confirm": {
        "type": "boolean",
        "description": "Set to true to drop the collection and all of its documents"
      }
    },
    "required": [
      "confirm"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "acknowledged": {
        "type": "boolean",
        "description": "True when the server confirmed the write"
      },
      "dropped": {
        "type": "boolean",
        "description": "False when the collection did not exist"
      }
    },
    "required": [
      "acknowledged",
      "dropped"
    ],
    "additionalProperties": {}
  }
}