Explanation: How I can remove the 0 elements from the array the output should be > 0 values.
{
"data1": [
0,
1,
1,
0,
0,
1,
1,
0
]
}
The output will be :
{
"data1": [
1,
1,
1,
1
]
}
Explanation: How I can remove the 0 elements from the array the output should be > 0 values.
{
"data1": [
0,
1,
1,
0,
0,
1,
1,
0
]
}
The output will be :
{
"data1": [
1,
1,
1,
1
]
}
{
"$project": {
"data1": {$filter: {
input: "$data1",
as : "p",
cond: {$gt: ["$$p", 0]} //<-- filter sub-array based on condition
}}
}}