Search code examples
vue.jsparse-serverback4app

Back4app Parse-sever : Find just get just the id not all data


Im on a find situacion because the result of the Parse.query is just the id and I had other columns :(

Response of find:

 [{"_objCount":0,"className":"DivorceCase","id":"8Ab15ASBX3"}]

Actual Code:

// Your corresponding keys
    Parse.initialize("xxx", "xxx");
// For back4app applications
    Parse.serverURL = 'https://parseapi.back4app.com'

var app = new Vue({
        el: "#AttorneyCases",
        data: {             
    DivorceCase :{},      
        },
  mounted:function(){
    new Parse.Query("DivorceCase").descending("createdAt").find()
    .then((DivorceCaseResponse) => {
      this.DivorceCase = DivorceCaseResponse;
    })
  }
  })

Solution

  • Thanks, nataliec!

    The final code is:

    mounted: function() {
        var Case = Parse.Object.extend("DivorceCase");
        var query = new Parse.Query(Case);
        query.find()
            .then((Ids) => {
    
                    Ids.forEach(element => {
    
                        var Case = Parse.Object.extend("DivorceCase");
                        var query = new Parse.Query(Case);
                        query.get(element.id)
                            .then((DivorceCaseResponse) => {
                                    // The object was retrieved successfully.
                                    this.DivorceCases.push(DivorceCaseResponse.get("BasicInfo"));
                                },
                                (e) => {
                                    // The object was not retrieved successfully.
                                    // error is a Parse.Error with an error code and message.
                                    swal({
                                        position: 'center',
                                        type: 'error',
                                        title: e.message,
                                        customClass: 'swal-wide'
                                    })
                                });
    
                    });
    
    
    
                },
                (e) => {
                    // The object was not retrieved successfully.
                    // error is a Parse.Error with an error code and message.
                    swal({
                        position: 'center',
                        type: 'error',
                        title: e.message,
                        customClass: 'swal-wide'
                    })
    
                });
    }