I’ve got the following data:
[
{
"RunInfo": {
"Errors:": [
0,
0,
0
],
"load": [
108422760,
259103136,
220934960
],
"timestamp": [
"2022-09-07T01:51:32Z",
"2022-09-07T01:52:31Z",
"2022-09-07T01:53:31Z"
],
"Mem": [
1335040,
1335040,
1335040
]
},
}
]
Can I query this so that I get it returned as one array of objects (each with timestamp,Error,load,mem) and then have it sorted by timestamp?
I’ve been having a hack around with the following:
db.collection.aggregate([
{
"$unwind": "$RunInfo"
},
{
"$set": {
"RunInfo.timestamp": {
"$arrayElemAt": [
"$values"
]
}
}
},
{
"$group": {
}
}
])
However I’m not following how to get through several collections at once and then re-create as new objects.
Any help would be appreciated.