My pipeline intermediate result looks like this:
[
{
"claim": [
{
"_id": "1-8101-2023-0445722",
"data_accadimento": {"$date": "2023-11-30T00:00:00.000Z"},
"index": 180,
"rainValue": 26.290000000000006,
"hailValue": 0,
"inundationValue": -1.7223792589410434,
"windValue": 5.940000057220459,
"lightningValue": 0
}
]
},
{
"claim": [
{
"_id": "1-8101-2023-0445722",
...
]
I am trying to access rainValue
inside a $project
stage by doing:
{
$project: {
claimRainValue: "$claim.0.rainValue"
}
},
However the result is an empty array.
Why? The number of elements inside the claim
array is one.