I have a code that returns a result. Normaly when I receive that result, I send it to the client and along the way it is converted to pure JSON object.
But now I need to do some operations on that result set, and then do another lookup in the database.
What I dont understand is the structure of the result set. How Do I properly iterate on it. I could extract the values manualy using a for loop, but I have a feeling that is not the way to do it.
This is the code that returns results:
models.Results.findAll({
where: {ProjectId: projectId}
})
.then(function (resultset) {
//How do I properly iterate over the resultset
for(p in resultset){
var a = p;
var something;
}
reply(resultset).code(200);
}, function (rejectedPromiseError) {
reply(rejectedPromiseError).code(401);
});
Image shows the result in debug mode. It has 4 objects in array: