← All procedures
mongo.documents.get
Get a single document by ID
MCPCLI- Package
- @procedures/mongo · README
- Path
["mongo","documents","get"]- CLI
mark mongo documents get --id <string>- MCP tool
mongo.documents.get on the dev-tools server- As data
{"$proc":["mongo","documents","get"],"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","get"], { id: "<id>" });
console.log(JSON.stringify(result));From the command line
$ mark mongo documents get --id <string>
As data, in a program
{ "$proc": ["mongo", "documents", "get"], "input": { "id": "<id>" } }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) |
id | string | yes | | The id of the document |
idType | "auto" | "objectId" | "string" | no | | How to read the id: "auto" (the default: an ObjectId or a string), "objectId" or "string" |
Output
| Field | Type | Required | Default | Description |
|---|
document | object | null | yes | | The document, or null when no document has the id |
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
},
"id": {
"type": "string",
"minLength": 1,
"description": "The id of the document"
},
"idType": {
"description": "How to read the id: \"auto\" (the default: an ObjectId or a string), \"objectId\" or \"string\"",
"type": "string",
"enum": [
"auto",
"objectId",
"string"
]
}
},
"required": [
"id"
]
},
"output": {
"type": "object",
"properties": {
"document": {
"anyOf": [
{
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
},
{
"type": "null"
}
],
"description": "The document, or null when no document has the id"
}
},
"required": [
"document"
],
"additionalProperties": {}
}
}