仅返回查询表达式中的属性值

时间:2018-03-05 04:49:48

标签: node.js amazon-web-services

嗨,我只需要从下面的代码中返回属性值

console.log('starting function');
var AWS = require('aws-sdk');
/*var ddb = new AWS.DynamoDB({apiVersion: '2012-08-10'});*/
const docClient = new AWS.DynamoDB.DocumentClient({region: 'us-east-1'});


var newResponse = 

exports.handler = (event, context, abcd) => {
var queryParameters = {
    TableName: 'Ignition1',
    KeyConditionExpression : 'GROUP_EDGE_ID = :Test',
    ExpressionAttributeValues: {
        ":Test":'Group-EdgeNode'
},

Limit : 1,
ScanIndexForward: false, // Returns the item with the Highest Primary Sort 
Key in this case the TIMESTAMP
/*FilterExpression: TempTag,*/
ProjectionExpression:  "TempTag",
//Select: "SPECIFIC_ATTRIBUTES",
 };


docClient.query(queryParameters, function(err, data){
   if(err){
        abcd(err, null);
        }else{
            abcd(null, data.Items);
        }

我得到的结果是

"TempTag": 60

我只需要返回60的属性值作为字符串。但我不确定如何进入那个阶段。

0 个答案:

没有答案