title: DynamoDB scanning using filter
body: <p>Im new to DynamoDB and have a table which is "<code>feeds</code>" and partition key is "<code>id</code>" and i have 3 other attributes which are "<code>category</code>", "<code>description</code>", "<code>pubDate</code>".</p>
  
  <p>I want to query the "category" attribute. But it doesn't work, because i can only query the partition key (hashkey), if im right.</p>
  
  <p>Now my query is that which doesnt work;</p>
  
  <pre><code>let category = event.category;
  
      const params = {
          Key: {
              "category": {
                  S: category
              }
          },
          TableName: "feeds"
      };
      dynamodb.getItem(params, function (err, data) {
          if (err) {
              console.log(err);
              callback(err);
          }
          else {
              console.log(data);
              callback(null, data);
          }
      });
  </code></pre>
  
  <p>How can i make it work? I tried to write a scan query but i couldn't understand the documentation of AWS good.</p>
  
  <p>Edit: I did make it work with the help of Dunedan. Here is the working code,</p>
  
  <pre><code>var params = {
        TableName: 'feeds',
        IndexName: 'category-index',
        KeyConditionExpression: 'category = :category',
        ExpressionAttributeValues: {
          ':category': 'backup',
        }
      };
  
      var docClient = new AWS.DynamoDB.DocumentClient();
  
      docClient.query(params, function(err, data) {
         if (err) callback(err);
         else callback(null, data);
      });
  </code></pre>