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

Support Convert to BsonValue in LINQ3

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 2.19.0
    • Affects Version/s: 2.18.0
    • Component/s: LINQ3
    • Labels:
      None

      Conversions to BsonValue are not supported in LINQ3. This was first discovered when running the test named `Bucket_typed_should_return_expected_result` against LINQ3.

      But it is more simply reproduceable:

      public class C
      {
          public int Id { get; set; }
          public int I { get; set; }
      }
      
      [Fact]
      public void Convert_to_BsonValue_should_work()
      {
          var client = DriverTestConfiguration.Linq3Client;
          var database = client.GetDatabase("test");
          var collection = database.GetCollection<C>("test");    
      
          var queryable = collection.AsQueryable().Select(x => new { V = (BsonValue)x.I });    
      
          var pipeline = queryable.ToString();
      }
       

       

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            robert@mongodb.com Robert Stam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: