title: Is Composite Primary Key in DynamoDB for Query
body: <p>As per this link:</p>
  
  <p><a href="http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/APISummary.html" rel="nofollow noreferrer">Supported Operations on DynamoDB</a></p>
  
  <p>"You can query only tables that have a composite primary key (partition key and sort key)."</p>
  
  <p>This doesn't seem correct though. I have a table in DynamoDB called 'users' which has a Primary Key that consists of only one attribute 'username'. </p>
  
  <p><a href="https://i.stack.imgur.com/1zOBg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1zOBg.png" alt="enter image description here"></a></p>
  
  <p>And I'm able to query this table just fine in NodeJS using only a 'KeyConditionExpression' on the attribute 'username'. Please see below:</p>
  
  <pre><code>var getUserByUsername = function (username, callback) {
  var dynamodbDoc = new AWS.DynamoDB.DocumentClient();
  
  var params = {
      TableName: "users",
      KeyConditionExpression: "username = :username",
      ExpressionAttributeValues: {
          ":username": username
      }
  };
  
  dynamodbDoc.query(params, function (err, data) {
      if (err) {
          console.error("Unable to query. Error:", JSON.stringify(err, null, 2));
          callback(err, null);
      } else {
          console.log("DynamoDB Query succeeded.");
          callback(null, data);
      }
  });
  </code></pre>
  
  <p>}</p>
  
  <p>This code works just fine. So I'm wondering if the documentation is incorrect or am I missing something? </p>