-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 2.5
-
Environment:Visual Studio 2017, both .Net framwork and .Net core.
Below query fails because Compare function in ExpressionComparer class in ExpressionComparer.cs file doesn't implement comparison for Pipeline typed expressions:
case ExpressionType.Extension:
var extensionA = (ExtensionExpression)a;
var extensionB = (ExtensionExpression)b;
if (extensionA.ExtensionType != extensionB.ExtensionType)
switch (extensionA.ExtensionType)
{
case ExtensionExpressionType.Accumulator:
return CompareAccumulator((AccumulatorExpression)extensionA, (AccumulatorExpression)extensionB);
case ExtensionExpressionType.Document:
return CompareDocument((DocumentExpression)a, (DocumentExpression)b);
case ExtensionExpressionType.FieldAsDocument:
return CompareDocumentWrappedField((FieldAsDocumentExpression)a, (FieldAsDocumentExpression)b);
case ExtensionExpressionType.Field:
return CompareField((FieldExpression)a, (FieldExpression)b);
case ExtensionExpressionType.SerializedConstant:
return CompareSerializedConstant((SerializedConstantExpression)a, (SerializedConstantExpression)b);
- //THIS IS MISSING
case ExtensionExpressionType.Pipeline:
return ComparePipelineExpression((PipelineExpression)a, (PipelineExpression)b);
*
//THIS EXCEPTION IS THROWN
default:
throw new MongoInternalException(string.Format("Unhandled mongo expression type: ' {0}'", extensionA.ExtensionType));
}
Here is the query:
in var Q = DB.Orders
.AsQueryable()
.Where(o => o.Status == Order.Statuses.Shipped && o.PurchaseDateTime >= DateTime.Now.Subtract(new TimeSpan(30, 0, 0, 0)) && o.PurchaseDateTime <= DateTime.Now)
.Join(DB.OrderFinances.AsQueryable(), outer => outer.OrderId, inner => inner.OrderId, (inner, outer) => new
)
.GroupBy(o => new
)
.Select(o => new
);
var R = Q.ToList();}}