[CSHARP-1702] IQueryable - Distinct operation fails following Select Created: 11/Jul/16  Updated: 23/Sep/16  Resolved: 05/Aug/16

Status: Closed
Project: C# Driver
Component/s: Linq
Affects Version/s: 2.2.4
Fix Version/s: 2.3

Type: Bug Priority: Major - P3
Reporter: Andrew Bennett Assignee: Craig Wilson
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 7


Attachments: Zip Archive DistinctOperation.zip    

 Description   

When an integer property of a typed document stored in mongo is selected, and a subsequent distinct operation is performed the following exception occurs:
Test method MongoInvestigation.Test.UnitTest1.TestMethod1 threw exception:
System.FormatException: Cannot deserialize a 'Int32' from BsonType 'Document'.
at MongoDB.Driver.Linq.MongoQueryProviderImpl`1.Execute(Expression expression)
at MongoDB.Driver.Linq.MongoQueryableImpl`2.GetEnumerator()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at MongoInvestigation.Test.UnitTest1.<TestMethod1>d__2.MoveNext() in C:\GITProjects\MongoInvestigation\MongoInvestigation.Test\UnitTest1.cs:line 37
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()

Please see attached code demonstrating the failure.



 Comments   
Comment by Githook User [ 05/Aug/16 ]

Author:

{u'username': u'craiggwilson', u'name': u'Craig Wilson', u'email': u'craiggwilson@gmail.com'}

Message: CSHARP-1702: adding support for field projection into Distinct operation across a Where call.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/e446cc9c2e9ec3661d0c48c47d5be25551664ef9

Comment by Craig Wilson [ 04/Aug/16 ]

https://mongodbcr.appspot.com/80860001/

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