[CSHARP-1430] LINQ OfType uses wrong projector when the current projector is a field. Created: 01/Oct/15  Updated: 20/Jan/16  Resolved: 01/Oct/15

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

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

Issue Links:
Related
is related to CSHARP-1429 Invalid query created when using unwi... Closed

 Description   

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 } }");



 Comments   
Comment by Githook User [ 01/Oct/15 ]

Author:

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

Message: CSHARP-1430: fixed issue with OfType providing the wrong projector.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/705e3ed600b4d4e24c8562fe1136c5c9b6a61d40

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