Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-1702

IQueryable - Distinct operation fails following Select

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.3
    • Affects Version/s: 2.2.4
    • Component/s: Linq
    • None
    • Environment:
      Windows 7

      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.

            Assignee:
            craig.wilson@mongodb.com Craig Wilson
            Reporter:
            andrew_scfc Andrew Bennett
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: