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","update"], { update: {} });
console.log(JSON.stringify(result));From the command line
$ mark mongo documents update --update <object>
As data, in a program
{ "$proc": ["mongo", "documents", "update"], "input": { "update": {} } }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"
},
"update": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {},
"description": "The update operations, for example { $set: { status: \"done\" } }"
},
"upsert": {
"description": "Insert a document when none matches",
"type": "boolean"
}
},
"required": [
"update"
]
},
"output": {
"type": "object",
"properties": {
"acknowledged": {
"type": "boolean",
"description": "True when the server confirmed the write"
},
"matchedCount": {
"type": "number",
"description": "The number of documents that matched"
},
"modifiedCount": {
"type": "number",
"description": "The number of documents that changed"
},
"upsertedId": {
"description": "The id of the new document of an upsert, as text, or null",
"type": [
"string",
"null"
]
},
"upsertedCount": {
"type": "number",
"description": "The number of documents that an upsert made"
}
},
"required": [
"acknowledged",
"matchedCount",
"modifiedCount",
"upsertedId",
"upsertedCount"
],
"additionalProperties": {}
}
}