Skip to content

Commit 3fb0a7a

Browse files
dkendrickcraiggwilson
authored andcommitted
Added aggregate options for AsQueryable
1 parent 1a8771e commit 3fb0a7a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/MongoDB.Driver/IMongoCollectionExtensions.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,14 @@ public static IAggregateFluent<TDocument> Aggregate<TDocument>(this IMongoCollec
4747
/// </summary>
4848
/// <typeparam name="TDocument">The type of the document.</typeparam>
4949
/// <param name="collection">The collection.</param>
50+
/// <param name="aggregateOptions">The aggregate options</param>
5051
/// <returns>A queryable source of documents.</returns>
51-
public static IMongoQueryable<TDocument> AsQueryable<TDocument>(this IMongoCollection<TDocument> collection)
52+
public static IMongoQueryable<TDocument> AsQueryable<TDocument>(this IMongoCollection<TDocument> collection, AggregateOptions aggregateOptions = null)
5253
{
53-
var provider = new MongoQueryProviderImpl<TDocument>(collection, new AggregateOptions());
54+
Ensure.IsNotNull(collection, nameof(collection));
55+
56+
aggregateOptions = aggregateOptions ?? new AggregateOptions();
57+
var provider = new MongoQueryProviderImpl<TDocument>(collection, aggregateOptions);
5458
return new MongoQueryableImpl<TDocument, TDocument>(provider);
5559
}
5660

0 commit comments

Comments
 (0)