title: dynamodb: how to filer all items which do not have a certain attribute?
body: <p>I have a table of users with a primary hash key of userId. each user may/may not have a string attribute called "environment".
  I would like to get all the users which have "environment"="xyz" or which do not have the "environment" attribute.</p>
  
  <p>The following code will filter those users with environment=xyz, but how do I filter those items with no environment at all? Dynamo API will not allow to filter on an empty String.</p>
  
  <pre><code>    AmazonDynamoDBClient client = DbClientManager.getDynamoDbClient();
  
      ArrayList&lt;AttributeValue&gt; avList = new ArrayList&lt;AttributeValue&gt;();
      avList.add(new AttributeValue().withS("xyz"));
  
      Condition scanFilterCondition = new Condition()
              .withComparisonOperator(ComparisonOperator.EQ.toString())
              .withAttributeValueList(avList);
      Map&lt;String, Condition&gt; conditions = new HashMap&lt;&gt;();
      conditions.put("environment", scanFilterCondition);
  
      ScanRequest scanRequest = new ScanRequest()
              .withTableName("users")
              .withAttributesToGet(
                      "userId", 
                      "environment");
              .withScanFilter(conditions);
  
      ScanResult result = client.scan(scanRequest);
  </code></pre>
  
  <p>For now I just dropped the scan filter, and I do the filtering client-side. Bit is there any way to do it server side?</p>
  
  <p>Thanks,
  Aliza</p>