[CSHARP-1353] DistinctAsync doesn't allow Sort or ToList Created: 19/Jul/15 Updated: 19/Jul/15 Resolved: 19/Jul/15 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | BSON |
| Affects Version/s: | 2.0.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Lorenz Buchberger | Assignee: | Robert Stam |
| Resolution: | Done | Votes: | 0 |
| Labels: | Distinct, DistinctAsync | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Visual Studio 2013 |
||
| Description |
|
I'm trying to use DistinctAsync with SortBy or ToListAsync, but it's not possible. Visual Studio does not show thes options when I use it. List<Job> distListe = await _mongoDb.Jobs works, but no Sort, no ToList. Am I'm doing anything wrong ? |
| Comments |
| Comment by Robert Stam [ 19/Jul/15 ] | ||
|
DistinctAsync doesn't have a sort option because the corresponding server command doesn't have a sort option either. You would have to sort the values client side after retrieving them. DistinctAsync returns a cursor. You can call ToListAsync on the cursor, like this:
|