← All procedures
mongo.documents.delete
Delete documents matching a filter
MCPCLI- Package
- @procedures/mongo · README
- Path
["mongo","documents","delete"]- CLI
mark mongo documents delete- MCP tool
mongo.documents.delete on the dev-tools server- As data
{"$proc":["mongo","documents","delete"],"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","documents","delete"], {});
console.log(JSON.stringify(result));From the command line
$ mark mongo documents delete
As data, in a program
{ "$proc": ["mongo", "documents", "delete"], "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) |
filter | object | no | | The filter of the documents (give exactly one of id or filter). An empty filter needs confirm: true. |
id | string | no | | The id of one document (the alternative to filter) |
idType | "auto" | "objectId" | "string" | no | | How to read the id: "auto" (the default: an ObjectId or a string), "objectId" or "string" |
multi | boolean | no | | Change every matching document, not only the first one |
confirm | boolean | no | | Set to true to use an empty filter, which matches every document |
Output
| Field | Type | Required | Default | Description |
|---|
acknowledged | boolean | yes | | True when the server confirmed the write |
deletedCount | number | yes | | The number of deleted documents |
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
},
"filter": {
"description": "The filter of the documents (give exactly one of id or filter). An empty filter needs confirm: true.",
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
},
"id": {
"description": "The id of one document (the alternative to filter)",
"type": "string",
"minLength": 1
},
"idType": {
"description": "How to read the id: \"auto\" (the default: an ObjectId or a string), \"objectId\" or \"string\"",
"type": "string",
"enum": [
"auto",
"objectId",
"string"
]
},
"multi": {
"description": "Change every matching document, not only the first one",
"type": "boolean"
},
"confirm": {
"description": "Set to true to use an empty filter, which matches every document",
"type": "boolean"
}
}
},
"output": {
"type": "object",
"properties": {
"acknowledged": {
"type": "boolean",
"description": "True when the server confirmed the write"
},
"deletedCount": {
"type": "number",
"description": "The number of deleted documents"
}
},
"required": [
"acknowledged",
"deletedCount"
],
"additionalProperties": {}
}
}