I use mongodb with c# driver.I have a collection which contains subdocument
public class EntityA
{
public string Name { get; set; }
public string Description { get; set; }
public List<EntityB> BItems { get; set; }
}
public class EntityB
{
public string BName { get; set; }
public string BDesc { get; set; }
}
I want to create query and take list of EntityB items
from a in mycollection
where BItems.Any(k => k.BName == entity.Name)
select a.BItems;
I can query nested document but when I retrive the list all other child items come to list how can I take list of BItems to meet up my criteria.I can query subdocument but when I want to take list All Bitems are coming to mylist