[CSHARP-4140] Only use $getField when absolutely necessary Created: 15/Apr/22 Updated: 28/Oct/23 Resolved: 19/Apr/22 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | LINQ3 |
| Affects Version/s: | 2.15.0 |
| Fix Version/s: | 2.15.1 |
| Type: | Bug | Priority: | Unknown |
| Reporter: | Felix König | Assignee: | Robert Stam |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
The LINQ3 driver is using '$getField' for projections in some circumstances, even though it shouldn't if the server does not support it yet. Here's a small unit test to showcase the problem:
The full stacktrace looks as follows:
|
| Comments |
| Comment by Felix König [ 01/Jun/22 ] |
|
It works now in 2.15.1, thanks! |
| Comment by Githook User [ 04/May/22 ] |
|
Author: {'name': 'rstam', 'email': 'robert@robertstam.org', 'username': 'rstam'}Message: |
| Comment by Githook User [ 04/May/22 ] |
|
Author: {'name': 'rstam', 'email': 'robert@robertstam.org', 'username': 'rstam'}Message: |
| Comment by Githook User [ 20/Apr/22 ] |
|
Author: {'name': 'rstam', 'email': 'robert@robertstam.org', 'username': 'rstam'}Message: |
| Comment by Githook User [ 19/Apr/22 ] |
|
Author: {'name': 'rstam', 'email': 'robert@robertstam.org', 'username': 'rstam'}Message: |
| Comment by Robert Stam [ 18/Apr/22 ] |
|
We don't actually use the server version when deciding whether to use `$getField` or not. In fact, at the point that decision is made we don't actually know the server version. Instead, we base the decision on the field name and whether we think it would be valid on its own or as part of a field path. Looks like we are being too conservative when making that decision. Apparently the server allows anything that doesn't start with a `$` or contain a `.` as a valid field name in `$<fieldname>`. We will change the logic to be more permissive in what is considered a valid field name that does not require using `$getField`. |