MongoDB issues for realtime display

Hi all,

We are new to grafana and we are trying to display some realtime data from a MongoDB datasource collection.
Documents in the collection has this json structure :

{

_id : ObjectId("string"),
measurement : array(1000), //measurement each millisecond
Timestamp_Unix : array(1000), //unix timestamp in seconds
Millisecond: array(1000) //millisecond to be added to the Timestamp_Unix

}

In the mongodb query editor we are using the following aggregation

[
    {
        "$addFields": {
            "Timestamp_Unix_ms": {
                "$map": {
                    "input": "$Timestamp_Unix", 
                    "as": "tus", 
                    "in": {
                        "$multiply": [
                            "$$tus", 1000
                        ]
                    }
                }
            }
        }
    }, {
        "$project": {
            "time": {
                "$map": {
                    "input": {
                        "$range": [
                            0, 999
                        ]
                    }, 
                    "as": "index", 
                    "in": {
                        "$add": [
                            {
                                "$arrayElemAt": [
                                    "$Timestamp_Unix_ms", "$$index"
                                ]
                            }, {
                                "$arrayElemAt": [
                                    "$Millisecond", "$$index"
                                ]
                            }
                        ]
                    }
                }
            }, 
            "measurement": 1
        }
    }, {
        "$limit": 10
    }
]

We can’t make it work with Time Series.
Is there anything wrong with the structure that we have?
Regards,
Elisa