Skip to content

Instantly share code, notes, and snippets.

@cmcculloh
Created April 26, 2012 20:26
Show Gist options
  • Save cmcculloh/2502794 to your computer and use it in GitHub Desktop.
Save cmcculloh/2502794 to your computer and use it in GitHub Desktop.
dynode getBatchItem example
var events = {
options: null,
getEventsList: function(){
console.log('events.getEvents() private: got here');
var opts = {
Limit: 15
};
dynode.query("event_types_timestamp", "Viewed Product", opts, events.getEventDetails);
},
getEventDetails: function(error, results, meta){
results.Items.forEach(function(element, index, array){
console.log(element);
element.events.SS.forEach(function(ielement, iindex, iarray){
var batchVars = {"events": {keys:[ {hash: ielement, range: parseInt(element.timestamp.N)} ]}};
console.log("+++++++++batchVars");
console.log(batchVars.events.keys);
console.log("++++++++++++++++++")
dynode.batchGetItem(batchVars, events.debugOutput);
}, query);
}, query);
},
debugOutput: function(error, results, meta){
console.log('===============');
console.log(error);
console.log(results);
console.log(meta);
console.log('===============')
}
};
exports.events = {
getEvents: function(options){
events.options = options;
events.getEventsList();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment