|
When using OData and sending $expand option with linq on the new driver (IMongoCollection) it throws exception:
"error": {
"code": "",
"message": "An error has occurred.",
"innererror": {
"message": "The 'ObjectContent`1' type failed to serialize the response body for content type 'application/json; odata.metadata=minimal'.",
"type": "System.InvalidOperationException",
"stacktrace": "",
"internalexception": {
"message": "The expression tree is not supported: IIF((
{document} == null), null, {document}
{groups}
)",
"type": "System.NotSupportedException",
"stacktrace": " at MongoDB.Driver.Linq.Processors.EmbeddedPipeline.EmbeddedPipelineBinder.BindNonMethodCall(Expression node)\r\n at MongoDB.Driver.Linq.Processors.PipelineBinderBase`1.Bind(Expression node)\r\n at MongoDB.Driver.Linq.Processors.PipelineBinderBase`1.BindPipeline(Expression node)\r\n at MongoDB.Driver.Linq.Processors.PipelineBinderBase`1.BindMethodCall(MethodCallExpression node)\r\n at MongoDB.Driver.Linq.Processors.PipelineBinderBase`1.Bind(Expression node)\r\n at MongoDB.Driver.Linq.Processors.EmbeddedPipeline.EmbeddedPipelineBinder.Bind(Expression node, IBindingContext parent)\r\n at MongoDB.Driver.Linq.Processors.SerializationBinder.Visit(Expression node)\r\n at System.Linq.Expressions.ExpressionVisitor.VisitConditional(ConditionalExpression node)\r\n at MongoDB.Driver.Linq.Processors.SerializationBinder.Visit(Expression node)\r\n at System.Linq.Expressions.ExpressionVisitor.VisitMemberAssignment(MemberAssignment node)\r\n at System.Linq.Expressions.ExpressionVisitor.Visit[T](ReadOnlyCollection`1 nodes, Func`2 elementVisitor)\r\n at System.Linq.Expressions.ExpressionVisitor.VisitMemberInit(MemberInitExpression node)\r\n at MongoDB.Driver.Linq.Processors.SerializationBinder.Visit(Expression node)\r\n at System.Linq.Expressions.ExpressionVisitor.VisitMemberAssignment(MemberAssignment node)\r\n at System.Linq.Expressions.ExpressionVisitor.Visit[T](ReadOnlyCollection`1 nodes, Func`2 elementVisitor)\r\n at System.Linq.Expressions.ExpressionVisitor.VisitMemberInit(MemberInitExpression node)\r\n at MongoDB.Driver.Linq.Processors.SerializationBinder.Visit(Expression node)\r\n at System.Linq.Expressions.ExpressionVisitor.VisitMemberAssignment(MemberAssignment node)\r\n at System.Linq.Expressions.ExpressionVisitor.Visit[T](ReadOnlyCollection`1 nodes, Func`2 elementVisitor)\r\n at System.Linq.Expressions.ExpressionVisitor.VisitMemberInit(MemberInitExpression node)\r\n at MongoDB.Driver.Linq.Processors.SerializationBinder.Visit(Expression node)\r\n at MongoDB.Driver.Linq.Processors.Pipeline.MethodCallBinders.SelectBinder.Bind(PipelineExpression pipeline, PipelineBindingContext bindingContext, MethodCallExpression node, IEnumerable`1 arguments)\r\n at MongoDB.Driver.Linq.Processors.MethodInfoMethodCallBinder`1.Bind(PipelineExpression pipeline, TBindingContext bindingContext, MethodCallExpression node, IEnumerable`1 arguments)\r\n at MongoDB.Driver.Linq.Processors.PipelineBinderBase`1.BindMethodCall(MethodCallExpression node)\r\n at MongoDB.Driver.Linq.Processors.PipelineBinderBase`1.Bind(Expression node)\r\n at MongoDB.Driver.Linq.Processors.Pipeline.PipelineBinder.Bind(Expression node, IBsonSerializerRegistry serializerRegistry)\r\n at MongoDB.Driver.Linq.MongoQueryProviderImpl`1.Prepare(Expression expression)\r\n at MongoDB.Driver.Linq.MongoQueryProviderImpl`1.Translate(Expression expression)\r\n at MongoDB.Driver.Linq.MongoQueryProviderImpl`1.Execute(Expression expression)\r\n at MongoDB.Driver.Linq.MongoQueryableImpl`2.GetEnumerator()\r\n at System.Web.OData.Formatter.Serialization.ODataFeedSerializer.WriteFeed(IEnumerable enumerable, IEdmTypeReference feedType, ODataWriter writer, ODataSerializerContext writeContext)\r\n at System.Web.OData.Formatter.ODataMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, HttpContent content, HttpContentHeaders contentHeaders)\r\n at System.Web.OData.Formatter.ODataMediaTypeFormatter.WriteToStreamAsync(Type type, Object value, Stream writeStream, HttpContent content, TransportContext transportContext, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.WebHost.HttpControllerHandler.<WriteBufferedResponseContentAsync>d__1b.MoveNext()"
}
}
}
|