Say I have the following document
Item
{
details: [
{
"title": "Name",
"content": "",
"is_private": false,
"order": 0,
"type": "text"
},
{
"title": "Price",
"content": "",
"is_private": true,
"order": 1,
"type": "text"
},
{
"title": "Company",
"content": "",
"is_private": false,
"order": 2,
"type": "text"
}
],
}
If I wanted to return only the subdocument fields details
which have is_private === false
, is there a way to do it in mongoose's query or do I need to use aggregation?
e.g.
ItemModel
.find()
// something should go here to remove