Details
-
Bug
-
Resolution: Works as Designed
-
Major - P3
-
None
-
2.7.2, 2.8.0, 2.9.0, 2.10.0, 2.11.2
-
None
-
.Net Core 3.1
MongoDB Server 4.4.1, MongoDB Server 4.0.19, MongoDB Server 4.2.2
Description
I trying to find documents with filter below
var filter = builder.Where(t => t.Array1.Any(l => !string.IsNullOrEmpty(model.ExternalId) &&
|
l.ExternalId == model.ExternalId ||
|
l.Name.ToLower() == model.Name.ToLower() ||
|
t.Address.ToLower() == model.Address.ToLower()));
|
But in result got an error
System.NotSupportedException: The LINQ expression: {document}{Locations}.Where((((False AndAlso ({document}{ExternalId} == null)) OrElse ({document}{Name}.ToLower() == "loc")) OrElse ({document}{Address}.ToLower() == "address"))) has the member "t" which can not be used to build a correct MongoDB query. |
On Driver version 2.7.2, .NetCore 2.1 and MongoDB Server 4.2 it works fine.
It seems to be related to CSHARP-2705 but not sure how to fix it.