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

LINQ OfType uses wrong projector when the current projector is a field.

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.1
    • Affects Version/s: 2.1
    • Component/s: Linq
    • None

      var query = CreateQuery()
                      .Select(x => x.C.E)
                      .OfType<V>()
                      .Where(v => v.W == 1111);
      

      Should generated this:

          Assert(query,
                      1,
                      "{ $project: { 'C.E': 1, _id: 0 } }",
                      "{ $match: { 'C.E._t': 'V' } }",
                      "{ $match: { 'C.E.W': 1111 } }");
      

      Rather, it generates this:

          Assert(query,
                      1,
                      "{ $project: { 'C.E': 1, _id: 0 } }",
                      "{ $match: { 'C.E._t': 'V' } }",
                      "{ $match: { 'W': 1111 } }");
      

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

              Created:
              Updated:
              Resolved: