When using syntax
var result = _collection.AsQueryable().Where(x => x.FSTicker == x.Sedol).ToList();
I'm getting exception:
Result Message: System.ArgumentException : Unsupported filter: (
{document}{fstick} == {document} {sedol}).Is there a way to us $where from c# code?
Now I'm using aggregation as a workaround.
full stack trace:
Test Name: Comparison
Test FullName: SoQuestionsSolver.CompareOnSameDocumentFieldsFeature.Comparison
Test Source: C:\Users\gbernas\Source\Repos\profesor79\SoQuestionsSolver\SoQuestionsSolver\CompareOnSameDocumentFields.feature : line 5
Test Outcome: Failed
Test Duration: 0:00:00.497
Result StackTrace:
at MongoDB.Driver.Linq.Translators.PredicateTranslator.Translate(Expression node)
at MongoDB.Driver.Linq.Translators.PredicateTranslator.Translate(Expression node, IBsonSerializerRegistry serializerRegistry)
at MongoDB.Driver.Linq.Translators.QueryableTranslator.TranslateWhere(WhereExpression node)
at MongoDB.Driver.Linq.Translators.QueryableTranslator.Translate(Expression node)
at MongoDB.Driver.Linq.Translators.QueryableTranslator.TranslatePipeline(PipelineExpression node)
at MongoDB.Driver.Linq.Translators.QueryableTranslator.Translate(Expression node)
at MongoDB.Driver.Linq.Translators.QueryableTranslator.Translate(Expression node, IBsonSerializerRegistry serializerRegistry)
at MongoDB.Driver.Linq.MongoQueryProviderImpl`1.Translate(Expression expression)
at MongoDB.Driver.Linq.MongoQueryProviderImpl`1.GetExecutionModel(Expression expression)
at MongoDB.Driver.Linq.MongoQueryableImpl`2.ToCursor(CancellationToken cancellationToken)
at MongoDB.Driver.IAsyncCursorSourceExtensions.ToList[TDocument](IAsyncCursorSource`1 source, CancellationToken cancellationToken)
at SoQuestionsSolver.CompareOnSameDocumentFieldsSteps.ThenTryToUseWhereClause() in C:\Users\gbernas\Source\Repos\profesor79\SoQuestionsSolver\SoQuestionsSolver\CompareOnSameDocumentFieldsSteps.cs:line 46
at lambda_method(Closure , IContextManager )
at TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration)
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStepMatch(BindingMatch match, Object[] arguments)
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStep(StepInstance stepInstance)
at TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnAfterLastStep()
at TechTalk.SpecFlow.TestRunner.CollectScenarioErrors()
at SoQuestionsSolver.CompareOnSameDocumentFieldsFeature.ScenarioCleanup()
at SoQuestionsSolver.CompareOnSameDocumentFieldsFeature.Comparison() in C:\Users\gbernas\Source\Repos\profesor79\SoQuestionsSolver\SoQuestionsSolver\CompareOnSameDocumentFields.feature:line 8
Result Message: System.ArgumentException : Unsupported filter: ({document}{fstick} == {document}{sedol}
).
- duplicates
-
CSHARP-1445 Support arbitrary filters in the LINQ provider.
- Closed