Skip to content

Commit 12e3eae

Browse files
committed
Fixed issues around array index expressions
1 parent bb625a9 commit 12e3eae

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/MongoFramework/Infrastructure/Querying/ExpressionTranslation.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,11 @@ public static BsonString GetFieldName(Expression expression)
147147

148148
while (true)
149149
{
150-
if (currentExpression is BinaryExpression binaryExpression && expression.NodeType == ExpressionType.ArrayIndex)
150+
if (currentExpression is BinaryExpression binaryExpression && currentExpression.NodeType == ExpressionType.ArrayIndex)
151151
{
152152
//The index is on the right
153153
var arrayIndex = TranslateSubExpression(binaryExpression.Right);
154-
partialNamePieces.Push(arrayIndex.AsString);
154+
partialNamePieces.Push(arrayIndex.ToString());
155155

156156
//The parent expression is on the left
157157
currentExpression = binaryExpression.Left;
@@ -169,7 +169,7 @@ public static BsonString GetFieldName(Expression expression)
169169
}
170170
else
171171
{
172-
throw new ArgumentException($"Unexpected node type {expression.NodeType}.");
172+
throw new ArgumentException($"Unexpected node type {currentExpression.NodeType}.");
173173
}
174174
}
175175
}

0 commit comments

Comments
 (0)