title: AWS DynamoDB querying with values in an array
body: <p>With the following (TableName: &quot;Table&quot;):</p>
  <pre class="lang-json prettyprint-override"><code>[
   {
    name: &quot;name1&quot;,
    values: [&quot;string1&quot;, &quot;string2&quot;]
   },
   {
    name: &quot;name2&quot;,
    values: [&quot;string1&quot;, &quot;string2&quot;, &quot;string3&quot;]
   }
  ]
  </code></pre>
  <p>My partition key would be <code>name</code>, without any sort key. I am trying to query all the items with the same <code>value</code> field. The following is what I have tried:</p>
  <pre class="lang-js prettyprint-override"><code>
  docClient.query({
        TableName: &quot;Table&quot;,
        KeyConditionExpression: &quot;name = :name&quot;,
        FilterExpression: &quot;contains(values, :value)&quot;,
        ExpressionAttributeValues: {
          &quot;:name&quot;: &quot;certain_name&quot;,
          &quot;:value&quot;: &quot;string1&quot;,
        },
      });
  
  </code></pre>
  <p>Suppose I want to query all the items with the <code>value</code> field of &quot;string1&quot;. However, AWS DynamoDB requires the <code>partition key</code> which is unique for all my items. Are there any ways to query all the items with the same <code>value</code> field, without bothering about the <code>partition key</code>?</p>
  <p>Or would a better approach be to just get all the items from DynamoDB, and just query with my own methods?</p>
  <p>Thank you everyone!</p>