Version
Upgraded to v5.0.3 from v4.1.4
Describe the bug
When try to .Find() with query inside, it shows Object reference not set to an instance of an object.
Code to Reproduce
public IEnumerable<Member> GetActiveMembers()
{
return databaseInstance.GetCollection<Member>("Members")
.Find(Query.Or(
Query.GTE("ExpireOnDateTime", DateTime.Now),
Query.EQ("ExpireOnDateTime", null)
))
.OrderBy(x => x.Name);
}
Expected behavior
Previously above code works find in v4.1.3.
Screenshots/Stacktrace
An unhandled exception has occurred while executing the request.
System.NullReferenceException: Object reference not set to an instance of an object.
at LiteDB.BsonExpressionParser.TryParseFunction(Tokenizer tokenizer, ExpressionContext context, Boolean isRoot)
at LiteDB.BsonExpressionParser.ParseSingleExpression(Tokenizer tokenizer, ExpressionContext context, Boolean isRoot)
at LiteDB.BsonExpressionParser.ParseFullExpression(Tokenizer tokenizer, ExpressionContext context, Boolean isRoot)
at LiteDB.BsonExpression.Parse(Tokenizer tokenizer, BsonExpressionParserMode mode, Boolean isRoot)
at LiteDB.BsonExpression.Create(String expression)
at LiteDB.Query.EQ(String field, BsonValue value)
Thanks again.
I stumbled upon this issue myself as well earlier today during the benchmarks. Still looking into it to see what's causing it because creating the BsonExpression manually does seem to work. 馃
For now, I've pinned the issue down to the Query.Or() BsonExpression, but I'll look into it further tomorrow.
Hi guys, the bug is on Query.EQ("...", **null**)). I'm fixing. For now, use BsonValue.Null
@josephinenewbie, just wanted to let you know that this issue (and the one I referenced #1527 ) will be fixed in the next update and therefore, I'll be closing this ticket.
If you come across a thsis issue after you've installed to new version (when it's available), please open a new issue (or reopen this ticket if you think it's exactly the same) 馃檪