Watch keynotes and sessions from MongoDB.live, our virtual developer conference.

Filter on MongoDB Charts

Hi. I am trying to set up charts using an aggregation. My question is how do i apply a filter on a document if the project stage only outputs the new fields I created. I use certain fields in the pipeline and even if I carry them through to the end it doesn’t seem that the filter applies to within the pipeline. I want to apply the filter to a field that is present in the original document and then want it to change the result of the aggregation. Below i will attach a pic of the aggregation as well as my data setup. So i am trying to see all the stats that each individual player performed which is listed under the value key. Later i then want to be able to filter on the value and that should then exclude certain player numbers.mongo1

Hello, @johan_potgieter!

Provide a readable javascript object (or array of objects), that you want to have as a result of your aggregation.

I want to be able to filter all the documents on a specific field that occurs within the documents but want to apply the filter with the javascript sdk. So at the moment i can filter the documents to a specif team name because only some of the documents contain that name. But I want to be able to create a filter that can be applied to values that occur all the documents after i run an aggregation. It is difficult to explain. So basically i want to output something like area with A,B,C,D and then be able to filter on that area.