Version
5.0.19
Exception: Method ToLowerInvariant() in String are not supported when convert to BsonExpression
Describe the bug
When using the ToLowerInvariant() method within the query expression, LiteDB throws an exception. This behavior occurs consistently whenever ToLowerInvariant() is utilized in the query expression.
Code to Reproduce
Create a query expression using ToLowerInvariant() method.
Execute the query with LiteDB.
Expected Behavior:
The query should execute without throwing any exceptions, even when ToLowerInvariant() method is used.
Actual Behavior:
LiteDB throws an exception when ToLowerInvariant() method is used in the query expression.
StackTrace:
at LiteDB.LinqExpressionVisitor.VisitMethodCall(MethodCallExpression node)
at LiteDB.LinqExpressionVisitor.VisitAsPredicate(Expression expr, Boolean ensurePredicate)
at LiteDB.LinqExpressionVisitor.VisitBinary(BinaryExpression node)
at System.Linq.Expressions.ExpressionVisitor.VisitLambda[T](Expression1 node) at LiteDB.LinqExpressionVisitor.VisitLambda[T](Expression1 node)
at LiteDB.LinqExpressionVisitor.Resolve(Boolean predicate)
at LiteDB.BsonMapper.GetExpression[T,K](Expression1 predicate) at LiteDB.LiteCollection1.FindOne(Expression`1 predicate)
Version 5.0.19 Exception: Method ToLowerInvariant() in String are not supported when convert to BsonExpression
Describe the bug When using the ToLowerInvariant() method within the query expression, LiteDB throws an exception. This behavior occurs consistently whenever ToLowerInvariant() is utilized in the query expression.
Code to Reproduce Create a query expression using ToLowerInvariant() method. Execute the query with LiteDB. Expected Behavior: The query should execute without throwing any exceptions, even when ToLowerInvariant() method is used.
Code Example: collection.FindOne(x => x.Id == "1".ToLowerInvariant())
Actual Behavior: LiteDB throws an exception when ToLowerInvariant() method is used in the query expression.
StackTrace: at LiteDB.LinqExpressionVisitor.VisitMethodCall(MethodCallExpression node) at LiteDB.LinqExpressionVisitor.VisitAsPredicate(Expression expr, Boolean ensurePredicate) at LiteDB.LinqExpressionVisitor.VisitBinary(BinaryExpression node) at System.Linq.Expressions.ExpressionVisitor.VisitLambda[T](Expression
1 node) at LiteDB.LinqExpressionVisitor.VisitLambda[T](Expression
1 node) at LiteDB.LinqExpressionVisitor.Resolve(Boolean predicate) at LiteDB.BsonMapper.GetExpression[T,K](Expression1 predicate) at LiteDB.LiteCollection
1.FindOne(Expression`1 predicate)