Skip to main content

API Reference

This reference is implementation-backed for gateway command handling and core aggregation extensions.

MongoDB Command Dispatch

Gateway parses OP_MSG command documents and dispatches by first command key.

Code anchor: services/gateway/src/proxy/handler/mod.rs.

Minimal Command Examples

Find

db.runCommand({
find: "users",
filter: { status: "active" },
projection: { _id: 1, email: 1 },
sort: { _id: 1 },
limit: 100
})

Aggregate

db.runCommand({
aggregate: "orders",
pipeline: [
{ $match: { status: "open" } },
{ $group: { _id: "$customerId", total: { $sum: "$amount" } } }
],
cursor: {}
})

Update

db.runCommand({
update: "users",
updates: [{ q: { _id: 1 }, u: { $set: { tier: "pro" } }, multi: false }]
})

ML Aggregation Extension

Train

{ $mlTrain: {
model: "model_name",
type: "randomForest",
features: ["f1", "f2"],
target: "label"
}}

Predict

{ $mlPredict: { model: "model_name" } }

Model Registry

{ $mlListModels: {} }
{ $mlDeleteModel: { model: "model_name" } }

For full model options and metrics, see ML Engine.

Compatibility and Semantics

All command/operator compatibility statements are maintained in Compatibility.