[CSHARP-1174] IBsonSerializer for a mapped member should flow through expression tree when result type is the same. Created: 28/Jan/15  Updated: 06/Apr/15  Resolved: 28/Jan/15

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0

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


 Description   

Given a class of type Person

class Person
{
  [BsonRepresentation(BsonType.ObjectId)]
  public string Id {get; set;}
}

The aggregation framework expression trees are currently losing the ObjectId representation.

.Project(x => new { MyId = x.Id })
.Match(x => x.MyId == "54b73ce5e9080a3534370443")

The Match should render the "54b73..." as an objectId in the query, but instead it renders it as a string because we lost the serialization information when we did a projection.



 Comments   
Comment by Craig Wilson [ 28/Jan/15 ]

This already works. I think the output in the bug report was simply misleading.

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