最佳答案
波纹管代码正在使用聚合和查找
public class ProductItemModel
{
public string Id { get; set; }
public Product[] Items { get; set; }
}
var _orderCollection = _context.GetCollection<Order>("Orders");
var _productCollection = _context.GetCollection<Product>("Products");
var data = (_orderCollection.Aggregate()
//.Match(p => p.Id == "10000")
.Lookup<Order, Product, ProductItemModel>(
_productCollection,
x => x.Items,
x => x.Id,
x => x.Items)
).ToList();
关于c# - 如何使用 C# 连接 MongoDB 中一个表包含另一个表的 ID 列表的两个表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60502507/