var pipeline = new[] { match, unwind, lookup, project, group };
AggregateResult result = collection.Aggregate(pipeline);

var aggregate = result.Response.GetValue(0);
var aggregateArr = aggregate.AsBsonArray;
fpOrderItem.ActiveSheet.Rows.Count = 0;
int ttt = 0;
foreach (var agg_result in aggregateArr)
{
var order_record = agg_result[“_id”];
var order_no = order_record[“order_no”].ToString();
var order_list_str = order_record[“order_list”];
var contents_str = order_record[“contents”];

List<ContentsDreamerEntity.ContentsDreamer> contents = BsonSerializer.Deserialize<List<ContentsDreamerEntity.ContentsDreamer>>(contents_str.ToJson());
OrderMongoEntity.OrderList order_list = BsonSerializer.Deserialize<OrderMongoEntity.OrderList>(order_list_str.ToJson());
if (contents.Count == 0)
{
Console.WriteLine(1);
}
if (ttt++ >= 16) Console.WriteLine(1);
displayOrderedBookRowNew(order_list, (contents.Count > 0 ? contents[0] : new ContentsDreamerEntity.ContentsDreamer()));
//Console.WriteLine(“isbn=”+contents[0].isbn+”, title=”+contents.title);
}