500 error Trying to create a stacked-bar chart directly from MongoDB

  • What Grafana version and what operating system are you using?
    Grafana Cloud

  • What are you trying to achieve?
    Stacked bar chart. Showing count of categories by date.

  • How are you trying to achieve it?
    Aggregation query to MongoDB. Following MongoDB data source for Grafana | Grafana Enterprise plugins documentation

  • What happened?
    500 Error.

  • What did you expect to happen?

  • Can you copy/paste the configuration(s) that you are having problems with?

db.XXX.aggregate([ 
  { "$match": { month: { "$gte": ISODate("2022-05-01")} } }, 
  { "$group": { _id: { month: "$month", status:"$status"}, count: { $sum: 1 } } }, 
  { "$project": { "_id": 0, "time": "$_id.month", "__metric": "$_id.status", "count": 1}}
])

Do you have one of the following?

  • One of the following account types:
    • Grafana Cloud: Pro customers, Advanced customers, or Pro trial users with the Enterprise plugin add-on enabled
    • Grafana Enterprise: Customers with an activated license and a user with Grafana server or organization administration permissions