LiteDB icon indicating copy to clipboard operation
LiteDB copied to clipboard

[BUG] Value was too small or to large int64 when using BsonExpression

Open kszwaj-catalogicsoftware opened this issue 3 years ago • 0 comments

Version 5.0.9 5.0.12

Describe the bug collection.Find(BsonExpression) is thrown exception.

When in BsonExpression put the value higher than max limit of Int64 or Int32. F.e 111111111111111111111111111111111111 it should be parsed as String, because the field which I try to find is String type. BsonExpression: "$.Name = 1111111111111111111111111"

Code to Reproduce results = col.Find($"$.{filters.First().var} {filters.First().op} \'{filters.First().val}\'").ToList();

Expected behavior A clear and concise description of what you expected to happen.

Screenshots/Stacktrace System.OverflowException: Value was either too large or too small for an Int64. at System.Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type) at System.Number.ParseInt64(ReadOnlySpan`1 value, NumberStyles styles, NumberFormatInfo info) at LiteDB.BsonExpressionParser.TryParseInt(Tokenizer tokenizer, BsonDocument parameters) at LiteDB.BsonExpressionParser.ParseSingleExpression(Tokenizer tokenizer, ExpressionContext context, BsonDocument parameters, DocumentScope scope) at LiteDB.BsonExpressionParser.ParseFullExpression(Tokenizer tokenizer, ExpressionContext context, BsonDocument parameters, DocumentScope scope) at LiteDB.BsonExpression.ParseAndCompile(Tokenizer tokenizer, BsonExpressionParserMode mode, BsonDocument parameters, DocumentScope scope)

Additional context Add any other context about the problem here.