I am trying to filter not just the fields but objects inside my array field. Referring to the example below, for segments field, I want my client to only get those objects in the segments array where isReleased === true
Example Schema
{
_id: 123456,
segments: [
{
name: 'Type A',
isReleased: false,
},
{
name: 'Type B',
isReleased: false,
},
{
name: 'Type C',
isReleased: true,
}
],
}
So basically, I want my client to just receive,
{
_id: 123456,
segments: [
{
name: 'Type C',
isReleased: true,
}
],
}