DynamoDB Query Request Limit Not working?

0

Hey guys working on a project. I'm able to query my dynamoDB index but it seems the limit parameters in my request isn't working. Any help?
var request = new QueryRequest
{
TableName = "exampleTable",
IndexName = "exampleIndex",
Limit = 3,
ExclusiveStartKey = lastKeyEvaluated,
ExpressionAttributeValues = new Dictionary<string, AttributeValue> {
{ ":val", new AttributeValue { S = "Yes" } },
{ ":v_1", new AttributeValue { N = "0" }}
},
KeyConditionExpression = "Active= :val and Amount > :v_1",
ProjectionExpression = "Active, Amount",
ScanIndexForward = false
};

  I have 6 items on my table. (Prototyping bigger project) One of which has a negative "Amount". So that one is filtered out. However I'm still returned with 5 responses. It seems something is wrong with my limit parameters. Any help?  

Thanks everyone.

gefragt vor 3 Jahren711 Aufrufe
1 Antwort
0

Okay cool, so basically the issue was not with the structure of my request but the actual processing of my queryasync. Whereas I was printing the info before the final key was evaluated now I called my print method after the final key was evaluated.

Client.QueryAsync(request, (result) => {

        if (result.Exception == null)  
        {  
             //previous spot for the foreach loop and the print method.  
              
            lastKeyEvaluated = result.Response.LastEvaluatedKey;  
            if (lastKeyEvaluated != null && lastKeyEvaluated.Count != 0)  
            {  
                foreach (Dictionary<string, AttributeValue> item  
                in result.Response.Items)  
                {  
                    PrintItem(item);  
                }  
                Query(lastKeyEvaluated);  
            }  
            else  
            {  
                Debug.Log("last one");  
            }  
        }  
        else  
        {  
            Debug.Log(result.Exception);  
        }  

    });
beantwortet vor 3 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen