I have this, is javascript and parse (backend)
obtenerArticulos: function(categorias){
var queryAllArticles = new Parse.Query("Articulo");
queryAllArticles.equalTo("lugar", "Universidad Icesi");
queryAllArticles.containedIn("categoria", categorias);
queryAllArticles.equalTo("estado", "aprobado");
queryAllArticles.find({
success: function(results){
//console.log("Los resultados son: "+ results);
var marcas = [];
for(marcaArticulo in results){
if(typeof marcaArticulo !== "function" && results.hasOwnProperty(marcaArticulo)){
var nueva = {
"id": marcaArticulo.id,
"latitude": marcaArticulo.latitude,
"longitude": marcaArticulo.longitude,
"altitude": marcaArticulo.altitude,
"accuracy": marcaArticulo.accuracy
};
marcas.push(nueva);
}
}
var resultados = JSON.stringify(nueva);
console.log("Las marcas son: "+ marcas);
console.log("Los resultados son: "+ resultados);
return results;
},
error: function(error){
console.log(error);
}
});
}
Categorias is like Mamifero. I think that all is wrong, I need to do:
- Create an empty list.
- Make a query of all Articles (Articulos) that match the queries.
- For each Articulo, consult each marcaArticulo (marcaArticulo Relation in Parse). Class Articulo Relation of MarcaAR in Articulo
- With each marcaArticulo, I have to create a new object.
- Save each object in the empty list.