I’m trying to concat the arrays that are the results of 2 lookup operations within a single aggregation pipeline. The results of both lookups are working fine, but the concat of them is resulting null and I cannot figure out why. Could be that Mongo wont acknowledge the lookup results as an array? But that doesnt make sense since I have access to it within the same project stage as arrays…So I dont know really…
The project stage from the pipeline:
{
$project: {
_id: 0,
visitsTime: 1,
bracketsTime: 1,
chartResult: {
$concatArrays: [
"$visitsTime",
"$bracketsTIme"
]
}
}
}
The current results:
[
{
"bracketsTime": [
{
"date": "04-08-2022",
"entryHours": 4.25
},
{
"date": "04-10-2022",
"entryHours": 6.5
}
],
"chartResult": null,
"visitsTime": [
{
"date": "04-20-2022",
"visitHours": 1
},
{
"date": "04-10-2022",
"visitHours": 3
},
{
"date": "04-08-2022",
"visitHours": 2
},
{
"date": "05-26-2022",
"visitHours": 2
}
]
}
]
Here is a link for a mongo playground I’ve been using for this pipeline:
Any suggestions would be greatly appreciated! thanks