[CSHARP-4522] Issue with Casting via C# LINQ Statements Created: 09/Feb/23 Updated: 28/Oct/23 Resolved: 22/Feb/23 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | LINQ3 |
| Affects Version/s: | 2.19.0 |
| Fix Version/s: | 2.19.1 |
| Type: | Bug | Priority: | Unknown |
| Reporter: | Mark Mann | Assignee: | Robert Stam |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Documentation Changes: | Not Needed |
| Documentation Changes Summary: | 1. What would you like to communicate to the user about this feature? |
| Description |
|
Creating the issue from forum post: https://www.mongodb.com/community/forums/t/issue-with-2-18-to-2-19-nuget-upgrade-of-mongodb-c-driver/211894/10
The problem is when attempting to cast an object as a particular type in a C# LINQ statement to satisfy the C# compiler and access properties, the mongo driver(according to the person who responded in the forum) is attempting to do a server-side $convert
This just started after upgrading from the C# Nuget 2.18 to 2.19. I've uploaded a simple test solution which demonstrates this.
I cannot use the following: public static T UpsertThing<T>( IMongoDatabase DB, Expression<Func<T, bool>> filter, T record) where T: AMongoThing
because we potentially cast as multiple different objects depending on the query and security we are attempting to achieve. |
| Comments |
| Comment by Githook User [ 24/Mar/23 ] |
|
Author: {'name': 'rstam', 'email': 'robert@robertstam.org', 'username': 'rstam'}Message: |
| Comment by Githook User [ 22/Feb/23 ] |
|
Author: {'name': 'rstam', 'email': 'robert@robertstam.org', 'username': 'rstam'}Message: |
| Comment by Robert Stam [ 09/Feb/23 ] |
|
Thank you for reporting this issue. I will begin investigating it soon. |