Hi! I have a mongodb collection with 2 arrays per document. “FRAME” and “NOSE_Y”. They’re the same length as eachother, and the FRAME array simply ascends from 0 (eg. [0, 1, 2, 3, 4…]). What I am trying to do is use the FRAME as the time value x axis and NOSE_Y as the y axis value.
However, grafana isn’t able to recognize my data as valid time series format. I suspect it’s because the datapoints contain “map” before each array for some reason, but I think it could also be because my whole approach to this is wrong? What I mean by that is this is what the table view shows:
Any help would be much appreciated. This is the query I’m using:
human_pos.POS.aggregate([
{"$match": {"FRAME": {"$exists": true}}},
{"$project": {
"data": {
"$zip": {
"inputs": ["$FRAME", "$NOSE_Y"]
}
}
}},
{"$unwind": "$data"},
{"$project": {
"time": {"$multiply": [{"$arrayElemAt": ["$data", 0]}, 1000]},
"value": {"$arrayElemAt": ["$data", 1]},
"_id": 0,
"doc_id": "$_id"
}},
{"$sort": {"time": 1}},
{"$group": {
"_id": "$doc_id",
"datapoints": {"$push": {"value": "$value", "time": "$time"}}
}}
])