Parse.com REST如何查询关系3表?

时间:2016-11-15 06:31:38

标签: parse-platform

我来自MySQL,所以我设计了像这样的parse.com表

Vehicle | license, year, & pool_id
Pool | address & city_id
City | name

Pool_id指向Pool的车辆指针, City_id在池中指向城市。

在mySQL中我们可以加入三个表并使用where子句。

在关系查询中,docs说

  

- data-urlencode' where = {" post":{" __ type":" Pointer"," className&#34 ;:"邮政""的ObjectID":" 8TOXdXf3tz"}}'

哪个查询关系1表基于对象ID

我如何查询车辆的城市名称=" somecity"?

1 个答案:

答案 0 :(得分:0)

在angularJS

var config = {
params: {
    where: {
        vehicle_year: "2013",
        pool_id: {
            $inQuery: {
                where: {
                    city_id: {
                        $inQuery: {
                            where: {
                                city_name: "Jakarta"
                            },
                            className: "city"                               
                        }

                    }
                    //pool_address: "JL. DEF"                       
                },
                className: "pool"                   
            }       
        },
        car_id: {
            $inQuery: {
                where: {
                    car_class_id: {
                        $inQuery: {
                            where: {
                                name: "Box"                                 
                            },
                            className: "car_class"                              
                        }
                    }                       
                },
                className: "car"                    
            }               
        }

    },
    include: 'pool_id.city_id,car_id.car_class_id',

},
headers: { 'X-Parse-Application-Id' : 'gMKfl1wDyk3m6I5x0IrIjJyI87sumz58' }  
};

然后

$http.get('http://ip/parse/classname', config).then(function(response){
}, function(error){
});