Thank you for confirming the version that being in use.
I’ve checked C# Driver release changelogs and as it turned out the exact problem was addressed in 3.2.0 version. Please find more information in the following Jira ticket: https://jira.mongodb.org/browse/CSHARP-4572
It would be a nice idea to bump the dependency. If it’s impossible to bump it for some reasons, you can try the following workaround:
var user = collection.FindSync(x => ((Car)(object)x.Vehicle).Model == "Test").FirstOrDefault();
Casting to object before casting to the Car could help translate your filter. Such trick helps sometimes. At least it makes the test work for me.
Thanks,
Oleksandr.
2 Likes