Hi,
I want to filter subdocuments in Mongo Charts Query.
I have a document with a field and a field of array of documents like:
{
'n': 1,
subdocuments_array: [sub_1, sub_2,...,sub_n],
},
{
'n':2,
subdocuments_array:[sub_1, sub_2,...,sub_n],
}
and so on.
These sub_n have the following form:
{
'value': some number
'flag1': 0 or 1,
'flag2': 0 or 1
}
I want to use only the subdocuments with flag1 and flag 2 equal to 1.
I’ve tried to use {'sub_n.flag': {$ne: 0}}
but this is filtering the entire document when there is a subdocument with flag equal to 0.
I hope you can help me.
Thank you.