[CSHARP-3685] Using GuidRepresentation.Standard makes it impossible to retrieve Documents by Id in C# Created: 24/May/21 Updated: 31/Mar/22 |
|
| Status: | Backlog |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | 2.12.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | _BLU N/A | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
MongoDb Server 4.4.6 |
||
| Description |
|
Hello,
Full example that creates a document and tries to find it by the Guid:
|
| Comments |
| Comment by Mikalai Mazurenka (Inactive) [ 03/Jun/21 ] | |||
|
I can confirm that this is a bug. I would like to highlight that you are using GuidRepresentationMode.V2, which is being deprecated (you can refer to the docs: MongoDB .NET driver reference: GuidRepresentationMode). So I would suggest to set the mode to V3, which makes your example work:
Another alternative to work around this issue is to set the GuidRepresentation in BsonDefaults:
This option is less preferable and is used instead of the serializer registration:
| |||
| Comment by Mikalai Mazurenka (Inactive) [ 31/May/21 ] | |||
|
Thank you for reporting this issue. I can confirm that I am able to reproduce it. We need some time to investigate it and will come back to you. |