← All procedures
mongo.documents.distinct
The distinct values of a field in the documents that match a filter
MCPCLI- Package
- @procedures/mongo · README
- Path
["mongo","documents","distinct"]- CLI
mark mongo documents distinct --field <string>- MCP tool
mongo.documents.distinct on the dev-tools server- As data
{"$proc":["mongo","documents","distinct"],"input":{}}
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","distinct"], { field: "<field>" });
console.log(JSON.stringify(result));From the command line
$ mark mongo documents distinct --field <string>
As data, in a program
{
"$proc": ["mongo", "documents", "distinct"],
"input": { "field": "<field>" }
}Input
Output
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
},
"field": {
"type": "string",
"minLength": 1,
"description": "The field, with dots for an embedded field (for example \"address.city\")"
},
"query": {
"description": "The filter of the documents (default: all documents)",
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {}
}
},
"required": [
"field"
]
},
"output": {
"type": "object",
"properties": {
"values": {
"type": "array",
"items": {},
"description": "The distinct values of the field. An array field gives each of its elements."
}
},
"required": [
"values"
],
"additionalProperties": {}
}
}