I am new in DynamoDb but I want to query data using .NET and I am I little bit confused that DynamoDb forces me to use Primary key and KeyConditionExpression.
For example in SQL I can do something like this SELECT * FROM tbl1 WHERE name = 'Alex'
and in this case name is NOT a primary key. But I can not do something similar in DynamoDb.
Here is my code:
var request = new QueryRequest
{
TableName = "CompanyCommunication",
KeyConditionExpression = "Id = :v_Id",
FilterExpression = "CompanyName = :v_Com",
ExpressionAttributeValues = new Dictionary<string, AttributeValue> {
{":v_Com", new AttributeValue { S = "Microsoft" }} , {":v_Id", new AttributeValue { S = "1" } } }
};
Id is my primary key. But I can not comment KeyConditionExpression or use some another field in KeyConditionExpression.
But how I can do a query not using primary key? For example, using only a CompanyName field.
Maybe I misunderstand something?