The plan of a find or an aggregation pipeline (read only: $out and $merge are refused)
Use it
In TypeScript
import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/mongo/register"; // registers its procedures
const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["mongo","documents","explain"], {});
console.log(JSON.stringify(result));From the command line
$ mark mongo documents explain
As data, in a program
{ "$proc": ["mongo", "documents", "explain"], "input": {} }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 a find (default: all documents). Not with pipeline.",
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
},
"projection": {
"description": "The fields of a find to give (1) or to leave out (0)",
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"anyOf": [
{
"type": "number",
"const": 0
},
{
"type": "number",
"const": 1
}
]
}
},
"sort": {
"description": "The sort order of a find: { field: 1 } ascending, { field: -1 } descending",
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
},
"limit": {
"description": "The most documents of a find",
"type": "integer",
"minimum": 1,
"maximum": 9007199254740991
},
"pipeline": {
"description": "An aggregation pipeline to explain, in place of a find. $out and $merge are refused.",
"type": "array",
"items": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
}
},
"verbosity": {
"description": "queryPlanner (the default): the plan only. executionStats and allPlansExecution also run the plan.",
"type": "string",
"enum": [
"queryPlanner",
"executionStats",
"allPlansExecution"
]
}
}
},
"output": {
"type": "object",
"properties": {
"operation": {
"type": "string",
"enum": [
"find",
"aggregate"
],
"description": "The operation that the server explained"
},
"plan": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {},
"description": "The explain document of the server (queryPlanner, and executionStats with that verbosity)"
}
},
"required": [
"operation",
"plan"
],
"additionalProperties": {}
}
}