public override void Handle(UnaryExpression expression, VisitorContext context) { context.Visit(expression.Operand); var val = context.GetResult(); var result = new QueryObject(); result.Add("$not", val); context.SetResult(result); }
public override void Handle(MethodCallExpression expression, VisitorContext context) { context.Visit(expression.Arguments[1]); var matchCriteria = context.GetResult(); var regex = new QueryObject { { "$elemMatch", matchCriteria } }; var query = CreateQuery(expression.Arguments[0], regex, context); context.SetResult(query); }
public override void Handle(BinaryExpression expression, VisitorContext context) { var isAnd = expression.NodeType == ExpressionType.AndAlso || expression.NodeType == ExpressionType.And; context.Visit(expression.Left); context.Visit(expression.Right); var right = context.GetResult(); var left = context.GetResult(); var @operator = isAnd ? "$and" : "$or"; var query = new QueryObject { { @operator, new List <IDictionary <string, object> > { left, right } } }; context.SetResult(query); }