title: AWS Lambda scanning dynamoDB
body: <p>I want to scan DynamoDB to get records with price between 9 and 13. My code:</p>
  
  <pre><code>ar AWS = require('aws-sdk');
  var db = new AWS.DynamoDB();
  
  
  exports.handler = function(event, context) {
  
    var params = {
      TableName: "StreamsLambdaTable",
      ProjectionExpression: "price",  //specifies the attributes you want in the scan result.
      FilterExpression: "price between :lower and :higher",
      // ExpressionAttributeNames: {
      //     "#yr": "year",
      // },
      ExpressionAttributeValues: {
           ":lower": 9,
           ":higher": {"N": 13}
      }
  };
  
    db.scan(params, function(err, data) {
      if (err) {
        console.log(err); // an error occurred
        } 
      else {
        console.log(data.Item.name.S); // successful response
        context.done(null,{"Result": "Operation succeeded."});
        //res.send(data.name);
        }
     // return next();
    });
  };
  </code></pre>
  
  <p>But I've got 2 errors:</p>
  
  <ul>
  <li>InvalidParameterType: Expected params.ExpressionAttributeValues[':lower'] to be a structure</li>
  <li>InvalidParameterType: Expected params.ExpressionAttributeValues[':higher'].N to be a string]</li>
  </ul>
  
  <p>I tried two difffrent approaches (as you can see in the code:)</p>
  
  <pre><code>ExpressionAttributeValues: {
           ":lower": 9,
           ":higher": {"N": 13}
      }
  </code></pre>
  
  <p>but neither of them work. </p>
  
  <p>EDIT:</p>
  
  <p>I've got another problem. I want to get all those prices. I tried with that code:</p>
  
  <pre><code>data.Items.forEach(function(record) {
             console.log(
                  record.price + " dadada");
          });
  </code></pre>
  
  <p>But I get:</p>
  
  <pre><code>2016-06-14T20:33:23.915Z    3ce248c7-326f-11e6-855c-57839aedb817    [object Object] dadada
  2016-06-14T20:33:23.915Z    3ce248c7-326f-11e6-855c-57839aedb817    [object Object] dadada
  </code></pre>
  
  <p>EDIT 2:</p>
  
  <p>Soolved. Just changed record.price to record.price.N</p>