How to filter the array in the collection?


#1

Hello i am have collection:

{
   "_id" : 2,
   "name" : "bob",
   "age" : 42,
   "mess" : [ { "text" : 'hi', "countT" : 8 }, { "text" : 'no', "countT" : 20 } ]
}
{
   "_id" : 3,
   "name" : "ahn",
   "age" : 22,
   "mess" : [ { "text" : 'no', "countT" : 8 }, { "text" : 'hi', "countT" : 8 }, { "text" : 'no', "countT" : 20 } ]
}
{
   "_id" : 6,
   "name" : "abc",
   "age" : 43,
   "mess" : [ { "text" : 'good', "countT" : 8 }, { "text" : 'no', "countT" : 20 }, { "text" : 'good', "countT" : 8 }, { "text" : 'no', "countT" : 20 } ]
}

i am want display from this data, elements with “_id” = 6 and only fields: “mess” where “mess.text” = ‘good’