Open jeanfliu opened 1 day ago
Good catch. I just realized a better way to unmarshall raw values
var a json.RawMessage
bson.UnmarshalValue(bson.TypeArray, rawValue.Value, &a)
or
var a json.RawMessage
bson.UnmarshalValue(bson.TypeEmbeddedDocument, rawValue.Value, &a)
I will soon fix it
Hello,
I'm encountering an issue with the MongoDB plugin. When I run an aggregation query in Grafana, array data is returned in an object format rather than as a standard JSON array. Here’s an example:
Expected Output (e.g., from MongoDB in Robot 3T):
or
Actual Output (from this plugin in Grafana):
or
Steps to Reproduce:
Environment:
The plugin currently returns array data in an object format, with each array element indexed as a key-value pair. Numeric values are wrapped in
$numberDouble
, which complicates direct usage within Grafana.If the data source could return array data in a standard JSON array format, it could improve consistency and make data handling easier within Grafana.
Thanks for your work on this! Looking forward to your thoughts!