Making a timeseries graph for each document in my mongodb collection

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:

    {"$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"}}


Can you please post the actual raw data from 1 Mongo document?

Usually mongodb and other nosql documents are json objects. Your data seems unusual non json key value object. Why is that? Example doc

[{ name: “Rohan”, age: 13, subject: [ “hindi”, “geo” ] },{ name: “Akhil”, age: 14, subject: [ “marathi”, “history” ], place:“mumbai” }])

Hi yes! This is FRAME, which is an array: [0, 1, 2, 3, 4, 5…] (it just goes on until 370)

and my NOSE_Y array is also just an array of seemingly random numbers like that.

1 Like