Aggregate
g.sys.db.aggregate calls the aggregate schema API of any table from your code, with the same headers and query parameters as over HTTP. It returns the data, or the whole envelope when true is passed as the second argument.
MongoDB Simple aggregate¶
| MongoDB Simple aggregate | |
|---|---|
MongoDB headers¶
| MongoDB headers | |
|---|---|
MongoDB Basic aggregation¶
MongoDB $project stage¶
| MongoDB $project stage | |
|---|---|
MongoDB $addFields¶
| MongoDB $addFields | |
|---|---|
MongoDB $bucket¶
MongoDB $facet with multiple $bucket¶
MongoDB $collStats, latencyStats > histograms, storageStats, count¶
| MongoDB $collStats, latencyStats > histograms, storageStats, count | |
|---|---|
MongoDB $collStats, latencyStats > histograms, storageStats, count¶
| MongoDB $collStats, latencyStats > histograms, storageStats, count | |
|---|---|
MongoDB $count¶
| MongoDB $count | |
|---|---|
MongoDB $limit¶
| MongoDB $limit | |
|---|---|
MongoDB $lookup¶
| MongoDB $lookup | |
|---|---|
MongoDB $match¶
| MongoDB $match | |
|---|---|
MongoDB $redact, $cond, if, then, else, $$DESCEND, $$PRUNE¶
| MongoDB $redact, $cond, if, then, else, $$DESCEND, $$PRUNE | |
|---|---|
MongoDB $replaceRoot, newRoot¶
| MongoDB $replaceRoot, newRoot | |
|---|---|
MongoDB $sample¶
| MongoDB $sample | |
|---|---|
MongoDB $skip¶
| MongoDB $skip | |
|---|---|
MongoDB $sort¶
ascending¶
| MongoDB $sort | |
|---|---|
descending¶
| MongoDB $sort | |
|---|---|
MongoDB $unwind, $sortByCount¶
| MongoDB $unwind, $sortByCount | |
|---|---|
MongoDB $abs, $subtract¶
| MongoDB $abs, $subtract | |
|---|---|
MongoDB $add¶
| MongoDB $add | |
|---|---|
MongoDB $ceil, $floor¶
| MongoDB $ceil, $floor | |
|---|---|
MongoDB $divide¶
| MongoDB $divide | |
|---|---|
MongoDB $multiply¶
| MongoDB $multiply | |
|---|---|
MongoDB $arrayElemAt¶
| MongoDB $arrayElemAt | |
|---|---|
MongoDB $filter¶
| MongoDB $filter | |
|---|---|
MongoDB $in¶
| MongoDB $in | |
|---|---|
MongoDB $indexOfArray¶
| MongoDB $indexOfArray | |
|---|---|
MongoDB $isArray¶
MongoDB $map¶
| MongoDB $map | |
|---|---|
MongoDB $reverseArray¶
| MongoDB $reverseArray | |
|---|---|
MongoDB $size¶
MongoDB $and¶
| MongoDB $and | |
|---|---|
MongoDB $not¶
| MongoDB $not | |
|---|---|
MongoDB $or¶
| MongoDB $or | |
|---|---|
MongoDB $cmp¶
| MongoDB $cmp | |
|---|---|
MongoDB $eq¶
| MongoDB $eq | |
|---|---|
MongoDB $gt¶
| MongoDB $gt | |
|---|---|
MongoDB $gte¶
| MongoDB $gte | |
|---|---|
MongoDB $lt¶
| MongoDB $lt | |
|---|---|
MongoDB $lte¶
| MongoDB $lte | |
|---|---|
MongoDB $ne¶
| MongoDB $ne | |
|---|---|
MongoDB $cond¶
| MongoDB $cond | |
|---|---|
MongoDB $ifNull¶
| MongoDB $ifNull | |
|---|---|
MongoDB $switch¶
MongoDB $concat¶
| MongoDB $concat | |
|---|---|
MongoDB $max¶
| MongoDB $max | |
|---|---|
Structure¶
Multi-tenant¶
instance: "crm::acme"works on the database of the tenantacmeof the multi-tenant instancecrm.- With
instance: "crm", the call works on the database of the tenant of the request: a custom API called with the x-am-tenant-username header passes it on to the APIs it calls. A request without a tenant works on the structure database.
| Aggregate the customers of the tenant acme (MongoDB) | |
|---|---|