Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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:

  1. Create an empty list.
  2. Make a query of all Articles (Articulos) that match the queries.
  3. For each Articulo, consult each marcaArticulo (marcaArticulo Relation in Parse). Class Articulo Relation of MarcaAR in Articulo
  4. With each marcaArticulo, I have to create a new object.
  5. Save each object in the empty list.
share|improve this question
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.