如何将选项设置为GraphLookup,现在设置选项我无法设置泛型类型。
var options = new **AggregateGraphLookupOptions<BsonDocument, BsonDocument, BsonDocument>**
{
MaxDepth = 2,
};
var ss1 = aggregate.GraphLookup(this.EntitiesCol, "To", "From", startField, "destinations", **options**);在ss1之后,我将用于比赛和分组.
错误:
严重程度代码描述项目文件行抑制状态错误'IAggregateFluent.GraphLookup(IMongoCollection,FieldDefinition、FieldDefinition、AggregateExpressionDefinition、FieldDefinition、FieldDefinition、AggregateGraphLookupOptions)‘的类型参数不能从使用中推断。尝试显式指定类型参数。F:\ABC\eStepControl\eStepControl\EngineGit\dev\eStepControl.Engine\src\eStepControl.Infrastructure\Repositories\EdgesRepository.cs 684活动Abc.eStepControl.Infrastructure
发布于 2019-03-22 14:32:37
使用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);https://stackoverflow.com/questions/51191191
复制相似问题