[CSHARP-673] Support setting the cursor batch size when using LINQ queries Created: 05/Feb/13  Updated: 03/Dec/20  Resolved: 03/Dec/20

Status: Closed
Project: C# Driver
Component/s: Linq
Affects Version/s: 1.7
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: Robert Stam Assignee: Unassigned
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
related to CSHARP-692 Add support for the $comment meta ope... Closed
Case:

 Description   

Support setting the cursor batch size when using LINQ queries. A possible syntax (subject to revision) could be:

var query = collection.AsQueryable().Where(x => x.Y > 0).WithBatchSize(100);



 Comments   
Comment by Jeffrey Yemin [ 03/Dec/20 ]

Looks like this can be done now with the extension method:

       public static IMongoQueryable<TDocument> AsQueryable<TDocument>
                     this IMongoCollection<TDocument> collection, 
                    AggregateOptions aggregateOptions = null)

Comment by Robert Stam [ 07/Feb/13 ]

Consider also an open ended option system that could be more easily extended. For example:

var query = collection.AsQueryable<T>()
    .Where(x => ...)
    .WithOption(LinqQueryOption.BatchSize(100))
    .WithOption(LinqQueryOption.NoCursorTimeout)
    .WithOption(LinqQueryOption.IndexHint(...));

Comment by Robert Stam [ 07/Feb/13 ]

Consider also what other options might need to be supported (e.g. NoCursorTimeout, ...).

Generated at Wed Feb 07 21:37:30 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.