Filtering a lookup field in Series with query in MongoDB Charts


it tried to filter a lookup field in Series with the following query: {name:“Test1”} but it didn’t work.

is it possible to filter a lookup field in Series so the graph only shows one line?
i need this query for embedding my chart with JavaSDK.

Hi @Ruben -

For questions like this it’s useful to understand how Charts builds the aggregation pipeline. This is documented at Backing Aggregation Pipeline. Lookup fields aren’t explicitly listed (I’ll try to get that fixed) but they are included in step 5, Calculated Fields.

Since the Lookup stage happens after the query bar, the lookup field can’t be affected by the query. To fix this you have two options:

  1. Use the Filter pane to do your filtering, instead of the query bar (since this happens after the Lookup stage)
  2. Do the Lookup in a Data Source pipeline instead of using Lookup fields (since this happens before the Query Bar stage).



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