2014-10-05 145 views
1

我使用下面的代碼獲取項目徵集的Node.js從dynamodbdynamodb使用AWS SDK

var params = { 
    AttributesToGet: [ 
    "password" 
    ], 
    TableName : 'foo', 
    Key : { 
    "username" : { 
    "S" : "bar" 
    }, 
} 
} 

db.getItem(params, function(err, data) { 
if (err) { 
    console.log(err); // an error occurred 
    } 
else { 
    console.log(data); // successful response 
    res.send(data); 
    } 
return next(); 
}); 

得到一個項目,但存在這樣的情況,我不知道獲取的項目的鍵值。 我想知道我是否可以根據屬性值獲取項目。如下所示:

var params = { 
AttributesToGet: [ 
    "password" 
], 
TableName : 'foo', 
Attribute : { 
    "userlocation" : { 
    "S" : "EUROPE" 
    }, 
} 
} 

回答