protected internal virtual Expression VisitArrayIndex(ArrayIndexExpression node) { return(node.Update( Visit(node.Array), Visit(node.Index), node.Original)); }
protected internal override Expression VisitArrayIndex(ArrayIndexExpression node) { var field = Visit(node.Array) as IFieldExpression; if (field != null) { var constantIndex = node.Index as ConstantExpression; if (constantIndex == null) { throw new NotSupportedException($"Only a constant index is supported in the expression {node}."); } var index = constantIndex.Value.ToString(); if (index == "-1") { // We've treated -1 as meaning $ operator. We can't break this now, // so, specifically when we are flattening fields names, this is // how we'll continue to treat -1. index = "$"; } return new FieldExpression( field.AppendFieldName(index), node.Serializer); } return node; }
protected internal virtual Expression VisitArrayIndex(ArrayIndexExpression node) { return node.Update( Visit(node.Array), Visit(node.Index), node.Original); }
private BsonValue TranslateArrayIndex(ArrayIndexExpression node) { return new BsonDocument("$arrayElemAt", new BsonArray { TranslateValue(node.Array), TranslateValue(node.Index) }); }