I have the following problem I can currently get the [object Object] of each order, however I need to access its attributes and try the include function but I can not access it send me undefined
I leave my code and hope you can help me thank you very much
exports.pedido = function (req,res){
var currentUser = req.session.user;
if (currentUser){
var query_restaurante = new Parse.Query(Restaurante),
query_historial = new Parse.Query(Historial),
query_ordenes = new Parse.Query(Orden);
var restaurante;
query_restaurante.include("encargado");
query_restaurante.equalTo("encargado", {__type: "Pointer",className: "_User",objectId: currentUser.objectId});
query_restaurante.first().then(function(restaurante_encontrado){
restaurante = restaurante_encontrado;
query_historial.include("usuario");
query_historial.include("orden");
query_historial.equalTo("restaurantes", restaurante);
return query_historial.find();
console.log(query_historial)
}).then(function(historiales){
var context = {
title: "Menu",
restaurante: restaurante,
historial: historiales,
logo_restaurante: restaurante.get("logo"),
rating : restaurante.get("rating"),
suspender : restaurante.get("suspender"),
publicidad : restaurante.get("publicidad"),
};
return context;
}).then(function(context){
res.render('pedidos',context);
return res;
}, function(error) {
console.log("Error " + error.code + ": " + error.message);
res.redirect('/');
});
}else{
res.redirect('/');
}
}