MongoDB Charts - Aggregation Pipeline to get most recent value and CummulativeSum of a field

Hi @Dilip_Rajkumar -

The first scenario can be accomplished by using the Top Item chart type (under the Text category) instead of the Number chart. Top Item lets you specify a sort order and choose the specific fields you want from the matching document.

For the second scenario: You can use $setWindowFields in Charts, but since it’s an aggregation stage it needs to be used in the query bar, not within a single calculated field.

HTH
Tom

2 Likes