Replies: 3 comments 4 replies
|
You're correct—this is by design for security and performance reasons. Allowing clients to execute arbitrary aggregations would be dangerous, and there's no straightforward way to define permissions that restrict aggregation execution. Our security guidelines recommend:
Aggregations are parametric, so you can pre-define them and invoke them from Grafana with different parameters. If this doesn't cover your use case, you can easily create a custom service that accepts aggregation pipelines in the request body and executes them. |
|
For an example of service executing custom command on mongodb see https://github.com/SoftInstigate/restheart/tree/master/examples/mongo-status-service |
|
Let me clarify - I'm not suggesting you rewrite the RESTHeart Mongo service. It's quite complex, and those features aren't meant to be available to custom plugins. A plugin should only depend on restheart-commons and avoid using internal APIs. What I actually suggested was simply adding a |
Uh oh!
There was an error while loading. Please reload this page.
Hello,
Why does RESTHeart require aggregations to be pre-defined in collection metadata (aggrs) instead of allowing ad-hoc aggregation pipelines to be executed directly via a single HTTP request (similar to running db.collection.aggregate([...]) in mongosh)?
I understand from the documentation that only named aggregations can be invoked using
GET /collection/_aggrs/{name}, and that pipelines must be defined via a PATCH/metadata update.
However, this creates limitations for dynamic dashboards (e.g., using Grafana Infinity), where a single-request, inline aggregation would be very useful.
Is this design choice intentional for security or performance reasons, or is it simply a current implementation limitation?
Additionally, is support for ad-hoc aggregation pipelines planned (e.g., POST /collection/_aggregate with a pipeline in the request body)?
All reactions