MongoDB Atlas Data API MCP Server for Cloudflare Workers
MongoDB Atlas Data API MCP Server for Cloudflare Workers
mongodb_aggregateRun an aggregation pipeline on a MongoDB collection. The aggregation pipeline is MongoDB's powerful data processing framework. Each stage transforms the documents as they pass through the pipeline. Args: - database: Database name (required) - collection: Collection name (required) - pipeline: Aggregation pipeline as JSON array of stage objects (required) Common pipeline stages: - $match: Filter documents (like find) - $group: Group documents and compute aggregates - $sort: Sort documents - $limit: Limit number of documents - $skip: Skip documents - $project: Reshape documents (include/exclude/compute fields) - $unwind: Deconstruct array fields - $lookup: Join with another collection - $count: Count documents - $addFields: Add computed fields Example pipeline (count by status): [ { "$match": { "active": true } }, { "$group": { "_id": "$status", "count": { "$sum": 1 } } }, { "$sort": { "count": -1 } } ] Example pipeline (join with lookup): [ { "$match": { "orderId": "123" } }, { "$lookup": { "from": "customers", "localField": "customerId", "foreignField": "_id", "as": "customer" }}, { "$unwind": "$customer" } ]
mongodb_countCount documents in a MongoDB collection matching a filter. This is a convenience wrapper around the aggregation pipeline. Args: - database: Database name (required) - collection: Collection name (required) - filter: Query filter as JSON object (optional, defaults to {} for all documents) Returns: The count of matching documents. Example filter: { "status": "active", "type": "premium" }
mongodb_distinctGet distinct values for a field in a MongoDB collection. This is a convenience wrapper around the aggregation pipeline. Args: - database: Database name (required) - collection: Collection name (required) - field: Field name to get distinct values for (required) - filter: Query filter as JSON object (optional) Returns: Array of distinct values for the specified field. Example: Get all unique statuses: field="status"
mongodb_group_byGroup documents by a field and compute aggregates. This is a convenience wrapper around the $group aggregation stage. Args: - database: Database name (required) - collection: Collection name (required) - groupBy: Field name to group by (required) - filter: Query filter as JSON object (optional) - aggregations: JSON object with aggregation operations (optional) - count: true to include count - sum: field name to sum - avg: field name to average - min: field name to get minimum - max: field name to get maximum Returns: Grouped results with computed aggregates. Example: Group orders by status with total amount groupBy: "status" aggregations: { "count": true, "sum": "amount" }
+8 more tools
Sign up free and start integrating in minutes.