query_datamart
Run custom MongoDB queries against ITM DataMart to filter, list, or aggregate project components for advanced analysis beyond standard typed tools.
Instructions
Run a custom query against ITM DataMart (MongoDB-backed). For advanced analysis beyond typed tools.
Operations:
"components": list with filters. Params: where, project, sort, limit (max 200), skip
"component": single by ID. Params: id, project
"aggregateComponents": aggregation pipeline. Params: pipeline (must end with $limit, max 1000)
Allowed filter operators: $eq, $ne, $in, $nin, $gt, $gte, $lt, $lte, $regex, $options, $exists, $not, $and, $or, $nor Allowed pipeline stages: $match, $project, $group, $sort, $limit, $skip, $unwind, $addFields, $set, $unset Banned: $lookup, $merge, $out, $function, $accumulator, $where, $facet
Key fields: id, name, code, componentType, statusLabel, priorityLabel, percentComplete, startDate, endDate, methodology, managers, budgetTopDown, budgetActual, customFields (object keyed by field display name; see get_custom_fields).
Projecting full embedded arrays (tasks: 1, risks: 1, etc.) is rejected as too large; use dot notation (e.g. "tasks.name": 1) or the subcomponent tools with limit/skip.
This account defines custom fields. In DataMart documents they live under "customFields", an object keyed by the field's display name. Keys present (with component counts):
project: "Exposure" (13), "Invoice paid" (13), "Client acceptance date" (13), "Area" (13), "ERP Code" (13) Query them via query_datamart: project {"customFields": 1} to read all values, or where {"customFields.": ...} to filter. Keys are case- and accent-sensitive and may contain trailing spaces. Keys with lower counts than their siblings are usually language variants of the same field on multilingual accounts; cover both variants with $or when totals matter. Field types and dropdown values: get_custom_fields and get_custom_field_options.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Component ID (for "component" operation) | |
| skip | No | Offset for pagination | |
| sort | No | Sort spec (1 = ascending, -1 = descending) | |
| limit | No | Max results (default 50, max 200 for list, 1000 for agg) | |
| where | No | MongoDB filter (for "components") | |
| project | No | Field projection (1 = include) | |
| pipeline | No | Aggregation pipeline stages (must end with $limit) | |
| operation | Yes | The DataMart operation |