[CSHARP-4729] Using GeoJson2DCoordinates in a LINQ projection causes a System.NotSupportedException Created: 21/Jul/23 Updated: 31/Jul/23 |
|
| Status: | Backlog |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | 2.20.0 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Unknown |
| Reporter: | David Wolsey | Assignee: | Boris Dogadov |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | LINQ3 | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
SummaryUsing MongoDB.Driver.GeoJsonObjectModel.GeoJson2DCoordinates in a LINQ projection causes a System.NotSupportedException. This works as expected in version 2.18.0 of the driver but fails in 2.19 and 2.20. Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).2.19.0 and 2.20.0. How to ReproduceSee here for a reproduction. Given the following types
and the following code
calling GetPlaceEntities() works, but calling GetPlaceHeaders() causes the following exception: System.NotSupportedException: Serializer for MongoDB.Driver.GeoJsonObjectModel.GeoJson2DCoordinates must implement IBsonDocumentSerializer to be used with LINQ. Is it expected that the GeoJson types can't be used in LINQ projections when using the V3 LINQ provider? These projections work as expected with the V2 provider.
|
| Comments |
| Comment by David Wolsey [ 26/Jul/23 ] | |||||||||||||||||
|
Performing the projection client-side is fine for our current use-case so we'll do that and keep an eye on this ticket for any future server-side support. Thanks for looking into it. | |||||||||||||||||
| Comment by Boris Dogadov [ 25/Jul/23 ] | |||||||||||||||||
|
Thank you for raising this issue david.wolsey@gmail.com Projections involving GeoJson objects are actually executed on the client side with LINQ2 provider. LINQ3 introduced a different approach, where client side projections are not supported, and the whole expression is executed on server side. In this example the client side projection has to be done explicitly. Sync:
Async:
| |||||||||||||||||
| Comment by PM Bot [ 21/Jul/23 ] | |||||||||||||||||
|
Hi david.wolsey@gmail.com, thank you for reporting this issue! The team will look into it and get back to you soon. |