Skip to Main Content

MongoByte MongoDB Logo

Welcome to the new MongoDB Feedback Portal!

{Improvement: "Your idea"}
We’ve upgraded our system to better capture and act on your feedback.
Your feedback is meaningful and helps us build better products.

Status Submitted
Categories Charts
Created by Guest
Created on Nov 14, 2021

Allow to process totals

Allow the charts to do calculations on the totals, say we fields: [currentAmount, renewedAmount] And the chart shows as totals [1000, 800] Then it should allow to show it as .80 (or 80% with formatting), at least in a Text, Number Chart. Keep in mind, since so far what I've researched we can only do calculations on each field then it would not be possible to add ratios per document.
  • Guest
    Nov 15, 2021
    Thanks for the suggestion Gabriel. Just to make sure I understand the request: currently it is possible to add calculated fields (which can be used for things like ratios), however these fields are calculated per-document. So I think you want something like calculated fields that apply to the encoded/grouped values, for example on the total values from all documents? That's a fair feature request. If you need this now there is a workaround which is to pre-group the data in a pipeline, e;g: [ { $group: { _id: {}, totalCurrent: { $sum: '$currentAmount' }, totalRenewed: { $sum: '$renewedAmount' } }] ...and then you can calculate the ratio using a calculated field, or a separate $set stage in the pipeline.