craiggwilson/fluent-mongo — Issue #40: "A mongo field must be a part of the Contains method." when querying using Id property
Author: Kostassoid
Created: 2011-11-28 15:11:13+00:00
State: open

When querying something like:

experts.Where(e => authorsIds.Contains(e.Id)).ToList()

where experts is a fluent-mongo Queryable collection and authorsIds is just some List.

Id is declared as

public Guid Id { get; protected set; }

I'm getting:

FluentMongo.Linq.InvalidQueryException : A mongo field must be a part of the Contains method.
at FluentMongo.Linq.Translators.BsonDocumentFormatter.VisitMethodCall(MethodCallExpression m) in D:\Projects\ExternalLibs\fluent-mongo\src\FluentMongo\Linq\Translators\BsonDocumentFormatter.cs: line 196
at FluentMongo.Linq.Expressions.ExpressionVisitor.Visit(Expression exp) in D:\Projects\ExternalLibs\fluent-mongo\src\FluentMongo\Linq\Expressions\ExpressionVisitor.cs: line 62
at FluentMongo.Linq.Translators.MongoQueryObjectBuilder.VisitSelect(SelectExpression select) in D:\Projects\ExternalLibs\fluent-mongo\src\FluentMongo\Linq\Translators\MongoQueryObjectBuilder.cs: line 81
at FluentMongo.Linq.Translators.MongoQueryObjectBuilder.VisitProjection(ProjectionExpression projection) in D:\Projects\ExternalLibs\fluent-mongo\src\FluentMongo\Linq\Translators\MongoQueryObjectBuilder.cs: line 87
at FluentMongo.Linq.Translators.MongoQueryObjectBuilder.Build(Expression expression) in D:\Projects\ExternalLibs\fluent-mongo\src\FluentMongo\Linq\Translators\MongoQueryObjectBuilder.cs: line 19
at FluentMongo.Linq.ExecutionBuilder.VisitProjection(ProjectionExpression projection) in D:\Projects\ExternalLibs\fluent-mongo\src\FluentMongo\Linq\ExecutionBuilder.cs: line 21
at FluentMongo.Linq.MongoQueryProvider.Execute(Expression expression) in D:\Projects\ExternalLibs\fluent-mongo\src\FluentMongo\Linq\MongoQueryProvider.cs: line 98
at FluentMongo.Linq.MongoQuery`1.GetEnumerator() in D:\Projects\ExternalLibs\fluent-mongo\src\FluentMongo\Linq\MongoQuery.cs: line 102
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList(IEnumerable`1 source)
at Finam.WorldEye.Service.BackOfficeService.HydrateOpinions(IList`1 opinions) in OpinionService.cs: line 40
at Finam.WorldEye.Service.BackOfficeService.GetOpinionsFor(Guid topic) in OpinionService.cs: line 58
at Castle.Proxies.Invocations.IOpinionService_GetOpinionsFor.InvokeMethodOnTarget()
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Finam.WorldEye.Configuration.Interceptors.RetryInterceptor.Intercept(IInvocation invocation) in RetryInterceptor.cs: line 33
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Finam.WorldEye.Service.Interceptors.BusinessContextInterceptor.Intercept(IInvocation invocation) in BusinessContextInterceptor.cs: line 25
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Finam.WorldEye.Configuration.Interceptors.OpLogInterceptor.Intercept(IInvocation invocation) in OpLogInterceptor.cs: line 84
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Castle.Proxies.IBackOfficeServiceProxy.GetOpinionsFor(Guid topic)
at Finam.WorldEye.Service.Tests.BackOfficeServiceSpecs.when_retrieving_existing_opinions_for_topic.operation_should_succeed() in BackOfficeServiceSpecs.cs: line 896