i am trying to fetch element based on a property of a sub collection.
var filter = Builders<User>.Filter.ElemMatch(x => x.BusinessRequestStatuses, x => x.RequestId == requestId);
var res = await collection.Find(filter).ToListAsync();
and document structure for "User" looks like this
BusinessRequestStatuses is array of custom type
public List<BusinessRequestStatus> BusinessRequestStatuses { get; set; }
and BusinessRequestStatus is as below
public class BusinessRequestStatus
{
public string RequestId { get; set; }
public RequestStatus Status { get; set; }
}
i am setting up a proper requestId that does exists in sub collection (first) but i dont get any result (res) back.