← All procedures
mongo.documents.count
Count documents matching a filter
MCPCLI- Package
- @procedures/mongo · README
- Path
["mongo","documents","count"]- CLI
mark mongo documents count- MCP tool
mongo.documents.count on the dev-tools server- As data
{"$proc":["mongo","documents","count"],"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","count"], {});
console.log(JSON.stringify(result));From the command line
$ mark mongo documents count
As data, in a program
{ "$proc": ["mongo", "documents", "count"], "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) |
query | object | no | | The filter of the documents to count (default: all documents) |
Output
| Field | Type | Required | Default | Description |
|---|
count | number | yes | | The number of documents that match |
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
},
"query": {
"description": "The filter of the documents to count (default: all documents)",
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
}
}
},
"output": {
"type": "object",
"properties": {
"count": {
"type": "number",
"description": "The number of documents that match"
}
},
"required": [
"count"
],
"additionalProperties": {}
}
}