![](/img/trans.png)
[英]MongoDB graphLookup using AggregateFluentExtensions
[英]AggregateGraphLookupOptions mongo GraphLookup set
如何将选项设置为GraphLookup ,现在设置选项我无法设置通用类型。
var options = new **AggregateGraphLookupOptions<BsonDocument, BsonDocument, BsonDocument>**
{
MaxDepth = 2,
};
var ss1 = aggregate.GraphLookup(this.EntitiesCol, "To", "From", startField, "destinations", **options**);
在ss1之后,我用于匹配和分组...
错误:
严重性代码说明项目文件行抑制状态错误CS0411无法从用法中推断方法'IAggregateFluent.GraphLookup(IMongoCollection,FieldDefinition,FieldDefinition,AggregateExpressionDefinition,FieldDefinition,FieldDefinition,AggregateGraphLookupOptions)'的类型参数。 尝试显式指定类型参数。 Abc.eStepControl.Infrastructure F:\\ ABC \\ eStepControl \\ eStepControl \\ EngineGit \\ dev \\ eStepControl.Engine \\ src \\ eStepControl.Infrastructure \\ Repositories \\ EdgesRepository.cs 684有效
使用AppendStage()方法添加graphLookup阶段,如下所示:
var graphLookupStage = new BsonDocument("$graphLookup",
new BsonDocument
{
{ "from", "someCollection" },
{ "startWith", "$reportsTo" },
{ "connectFromField", "reportsTo"},
{ "connectToField", "name" },
{ "as", "reportingHierarchy" },
{ "maxDepth", 1 },
{ "depthField", "depthField" } //optional
});
var result = collection.Aggregate().AppendStage<BsonDocument>(graphLookupStage);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.