Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# MongoDb选择结果上有连接的多个_C#_Mongodb_Linq_Aggregate - Fatal编程技术网

C# MongoDb选择结果上有连接的多个

C# MongoDb选择结果上有连接的多个,c#,mongodb,linq,aggregate,C#,Mongodb,Linq,Aggregate,我正在尝试使用MongoDb Linq驱动程序对来自select many的结果的集合执行联接 伪代码是 from x in something from y in x.subcollection join a in detailed on y.id equals a.id select new { x.field, x.someotherfield, a.somedetail, a.someotherdetail } 不幸的是,这种语法让我 System.NotSu

我正在尝试使用MongoDb Linq驱动程序对来自select many的结果的集合执行联接

伪代码是

from x in something
from y in x.subcollection
join a in detailed on y.id equals a.id
select new 
{
   x.field,
   x.someotherfield,
   a.somedetail,
   a.someotherdetail
}
不幸的是,这种语法让我

System.NotSupportedException : $project or $group does not support {document}.
我也愿意通过聚合管道fluent库来实现这一点,如果不能使用linq提供程序,但我不知道语法,文档是。。。缺少

我认为这将是一个放松,一个查找和一个投影-但如何呢

-------编辑-------

越来越近了,但还是没有雪茄

因此,展开似乎可以很好地工作,查找也可以很好地工作,问题是如何在投影阶段处理生成的BsonDocument

我知道有些类型重载可以提供类型,但为每个管道的每个阶段创建中间类型是不切实际的

我的问题是

  • 我似乎不得不硬铸BsonValue,而不是使用 一些奇怪的方法(bug?)
  • 加入的集合是 在我的示例中,它将始终包含1个数组(如预期的那样) 记录,我可以得到第一个ok作为一个B文件,但我不能钻 进一步说,[“FirstName”]调用失败,并显示“不匹配” “找到的创建者”
请帮忙!

我看了看这里: