Created
April 26, 2012 20:26
-
-
Save cmcculloh/2502794 to your computer and use it in GitHub Desktop.
dynode getBatchItem example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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