Charts union of two collections on one Chart

I would like to display the union of two collections on one Chart, is this possible? I have a working aggregation using $unionWith, but it seems that this isn’t allowed in Charts, is there another way?

In the worst case I could create a separate collection and update it whenever the page holding the chart is opened, but I would like a more elegant solution.


Hi @David_Gregory -

As you noticed, we don’t currently support $unionWith directly in Charts. We need to explicitly test and enable new agg operators to ensure they are compatible with the Charts permissions model - in the case of $unionWith (similar to $lookup) we don’t want this to be a “back door” to gaining access to data that is not supposed to be shared, e.g. via an embedded chart.

That said, this is a valid scenario and I’ll see what we can do to unlock it. In the meantime, you can get around this by creating a view in the shell that uses the $unionWith and then adding a data source that points to that view.


1 Like

Thanks Tom,

that’s neater than my fallback solution.


This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.