Method Lookup
Lookup<TResult>(IAggregateFluent<TResult>, string, FieldDefinition<TResult>, FieldDefinition<BsonDocument>, FieldDefinition<BsonDocument>)
Appends a lookup stage to the pipeline.
public static IAggregateFluent<BsonDocument> Lookup<TResult>(this IAggregateFluent<TResult> aggregate, string foreignCollectionName, FieldDefinition<TResult> localField, FieldDefinition<BsonDocument> foreignField, FieldDefinition<BsonDocument> @as)
Parameters
aggregateIAggregateFluent<TResult>The aggregate.
foreignCollectionNamestringName of the foreign collection.
localFieldFieldDefinition<TResult>The local field.
foreignFieldFieldDefinition<BsonDocument>The foreign field.
asFieldDefinition<BsonDocument>The field in the result to place the foreign matches.
Returns
- IAggregateFluent<BsonDocument>
The fluent aggregate interface.
Type Parameters
TResultThe type of the result.
Lookup<TResult, TForeignDocument, TNewResult>(IAggregateFluent<TResult>, IMongoCollection<TForeignDocument>, Expression<Func<TResult, object>>, Expression<Func<TForeignDocument, object>>, Expression<Func<TNewResult, object>>, AggregateLookupOptions<TForeignDocument, TNewResult>)
Appends a lookup stage to the pipeline.
public static IAggregateFluent<TNewResult> Lookup<TResult, TForeignDocument, TNewResult>(this IAggregateFluent<TResult> aggregate, IMongoCollection<TForeignDocument> foreignCollection, Expression<Func<TResult, object>> localField, Expression<Func<TForeignDocument, object>> foreignField, Expression<Func<TNewResult, object>> @as, AggregateLookupOptions<TForeignDocument, TNewResult> options = null)
Parameters
aggregateIAggregateFluent<TResult>The aggregate.
foreignCollectionIMongoCollection<TForeignDocument>The foreign collection.
localFieldExpression<Func<TResult, object>>The local field.
foreignFieldExpression<Func<TForeignDocument, object>>The foreign field.
asExpression<Func<TNewResult, object>>The field in the result to place the foreign matches.
optionsAggregateLookupOptions<TForeignDocument, TNewResult>The options.
Returns
- IAggregateFluent<TNewResult>
The fluent aggregate interface.
Type Parameters
TResultThe type of the result.
TForeignDocumentThe type of the foreign collection.
TNewResultThe type of the new result.
Lookup<TResult>(IAggregateFluent<TResult>, IMongoCollection<BsonDocument>, BsonDocument, PipelineDefinition<BsonDocument, BsonDocument>, FieldDefinition<BsonDocument, IEnumerable<BsonDocument>>)
Appends a lookup stage to the pipeline.
public static IAggregateFluent<BsonDocument> Lookup<TResult>(this IAggregateFluent<TResult> aggregate, IMongoCollection<BsonDocument> foreignCollection, BsonDocument let, PipelineDefinition<BsonDocument, BsonDocument> lookupPipeline, FieldDefinition<BsonDocument, IEnumerable<BsonDocument>> @as)
Parameters
aggregateIAggregateFluent<TResult>The aggregate.
foreignCollectionIMongoCollection<BsonDocument>The foreign collection.
letBsonDocumentThe "let" definition.
lookupPipelinePipelineDefinition<BsonDocument, BsonDocument>The lookup pipeline.
asFieldDefinition<BsonDocument, IEnumerable<BsonDocument>>The as field in the result in which to place the results of the lookup pipeline.
Returns
- IAggregateFluent<BsonDocument>
The fluent aggregate interface.
Type Parameters
TResultThe type of the result.
Lookup<TResult, TForeignDocument, TAsElement, TAs, TNewResult>(IAggregateFluent<TResult>, IMongoCollection<TForeignDocument>, BsonDocument, PipelineDefinition<TForeignDocument, TAsElement>, Expression<Func<TNewResult, TAs>>, AggregateLookupOptions<TForeignDocument, TNewResult>)
Appends a lookup stage to the pipeline.
public static IAggregateFluent<TNewResult> Lookup<TResult, TForeignDocument, TAsElement, TAs, TNewResult>(this IAggregateFluent<TResult> aggregate, IMongoCollection<TForeignDocument> foreignCollection, BsonDocument let, PipelineDefinition<TForeignDocument, TAsElement> lookupPipeline, Expression<Func<TNewResult, TAs>> @as, AggregateLookupOptions<TForeignDocument, TNewResult> options = null) where TAs : IEnumerable<TAsElement>
Parameters
aggregateIAggregateFluent<TResult>The aggregate.
foreignCollectionIMongoCollection<TForeignDocument>The foreign collection.
letBsonDocumentThe "let" definition.
lookupPipelinePipelineDefinition<TForeignDocument, TAsElement>The lookup pipeline.
asExpression<Func<TNewResult, TAs>>The as field in
TNewResultin which to place the results of the lookup pipeline.optionsAggregateLookupOptions<TForeignDocument, TNewResult>The options.
Returns
- IAggregateFluent<TNewResult>
The fluent aggregate interface.
Type Parameters
TResultThe type of the result.
TForeignDocumentThe type of the foreign collection documents.
TAsElementThe type of the as field elements.
TAsThe type of the as field.
TNewResultThe type of the new result.