Hi,
Before telling about the problem, I would like to present about the thing I am doing. I need to access data from three dynamo table. For example.
- UserTable - user_id, zone_ids (in list)
- ZoneTable - zone_id, device_ids [in list)
- RegionTable - region_id, zone_ids (in list)
I want to retrieve all device in a zone that associate with a user.
So, firstly, I tried to get the list of zone_id from user table which is going to use when I try to get list of device from zone table by using zone_id getting from user table.
The problem is that when I tried to push the data (zone_ids) from dynamodb scan function(scanning the user table to get zone_ids) to a list outside of DB scan code scope, I get only empty list rather than list of data (zone_ids).
How can I add the data into variable (list) from inside of dynamodb scan method.
var tmp =
docClient.scan( params, (error, result) => {
if(error) … else{ tmp.push(…) }
})
console.log(tmp) //empty list
What should I do?
Many thanks,
Kind Regards,
John