Mongodb Standalone server
Summary
Hello everyone,
I encountered an error when executing the query illustrated below.
varcollection = _mongoDb.GetCollection<MyCollection>();
var data = collection.AsQueryable().Any(x=>x.Identifier==newGuid("72E32DEE-6D98-427E-8863-263414DACC8D"));
The error is:
Exception has occurred: CLR/MongoDB.Driver.Linq.ExpressionNotSupportedException
Exception thrown: 'MongoDB.Driver.Linq.ExpressionNotSupportedException' in MongoDB.Driver.dll: 'Expression not supported: (x.Identifier == 72e32dee-6d98-427e-8863-263414dacc8d).'
at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToFilterTranslators.MethodTranslators.StringExpressionToRegexFilterTranslator.TranslateComparisonExpression(TranslationContext context, Expression expression, Expression leftExpression, AstComparisonFilterOperator comparisonOperator, Expression rightExpression)
From my understanding, it seems to be related to System.Linq.Queryable while using the MongoDB.Driver version 2.21 in .NET 7.
Does anyone have insights or solutions regarding this issue?
Your assistance is greatly appreciated. Thank you!
How to Reproduce
varcollection = _mongoDb.GetCollection<MyCollection>();
var data = collection.AsQueryable().Any(x=>x.Identifier==newGuid("72E32DEE-6D98-427E-8863-263414DACC8D"));
- duplicates
-
CSHARP-4803 Refactor StringExpressionToRegexFilterTranslator.TryTranslate to not use an exception for flow control when possible
- Closed