Dynamically select DB for Embedded Chart based on user

We are looking into using Mongo charts in a web based application. Our customer data is segregated on different data bases. Is there a way to embed a dashboard in an application that reads data from the correct DB based on the user.

Hi Mark,

This is not currently supported out of the box, a potential workaround is to duplicate the dashboard and hook it up with different databases/datasources, and in your application, based on the user, you could choose which embed dashboard to render.

If further filter is required within the embed dashboard filter can be applied to each embedded chart: https://www.mongodb.com/docs/charts/filter-embedded-charts/#filter-embedded-charts.

Also if you have any ideas on improvement for the SDK or the Charts app in general, please feel free to submit your idea or feedback through here: https://feedback.mongodb.com/forums/923524-charts.

Many thanks,

1 Like

Hi @Mark_Peterson, apologies for the delay in responding. You can dynamically apply a filter on a chart based on the user, but there is no way to dynamically select a collection or database. We are aware of this requirement for users who model data in this way, and are looking into options on how to support this in the future.