Parse.Query find() 方法未返回任何内容
Parse.Query find() method not returning anything
我查看了有关此主题的其他堆栈溢出帖子,看起来我 运行 发现了一些新东西。有问题的查询方法不在用户 table 上。
当我在 mBuilding object 中查询 distance 或许多其他列时,我得到了未定义的信息,尽管这些列显然在那里,我将列标题复制并粘贴到函数中以检查拼写。据我所知,唯一有效的查询是使用 objectId 获取并查找。 equalTo、select、withinMiles(至少)返回 null/undefined 结果。更有趣的是,即使 find() 之前的查询未定义,它也会适当地影响查找结果。这真是令人费解。
这是怎么回事?我的代码:
angular.module('startupApp')
.controller('warrantyCtrl', function ($scope) {
$scope.Building = {};
$scope.Building.parseUserId = Parse.User.current().id;
console.log($scope.Building.parseUserId);
var consumer = Parse.User.current();
var user = Parse.Object.extend("User");
var warrantys = Parse.Object.extend("warranty");
var mBuilding = new Parse.Query(warrantys);
var consumerQuery = new Parse.Query(Parse.User);
$scope.consumerBuilding = function() {
var location = consumer.get("location");
mBuilding.withinMiles("location", location, "distance");
mBuilding.find({
success: function (proximalwarrantys){
console.log(proximalwarrantys);
}
})
}
$scope.consumerBuilding();
});
问题是传递给 withinMiles
函数的距离应该是一个数字而不是 "distance"
:
withinMiles(key, point, maxDistance)
Add a proximity based constraint
for finding objects with key point values near the point given and
within the maximum distance given. Radius of earth used is 3958.8
miles.
Parameters:
{String} key
The key that the Parse.GeoPoint is
stored in.
{Parse.GeoPoint} point
The reference Parse.GeoPoint that is
used.
{Number} maxDistance
Maximum distance (in miles) of results to
return. Returns:
{Parse.Query}
Returns the query, so you can chain
this call.
我查看了有关此主题的其他堆栈溢出帖子,看起来我 运行 发现了一些新东西。有问题的查询方法不在用户 table 上。
当我在 mBuilding object 中查询 distance 或许多其他列时,我得到了未定义的信息,尽管这些列显然在那里,我将列标题复制并粘贴到函数中以检查拼写。据我所知,唯一有效的查询是使用 objectId 获取并查找。 equalTo、select、withinMiles(至少)返回 null/undefined 结果。更有趣的是,即使 find() 之前的查询未定义,它也会适当地影响查找结果。这真是令人费解。
这是怎么回事?我的代码:
angular.module('startupApp')
.controller('warrantyCtrl', function ($scope) {
$scope.Building = {};
$scope.Building.parseUserId = Parse.User.current().id;
console.log($scope.Building.parseUserId);
var consumer = Parse.User.current();
var user = Parse.Object.extend("User");
var warrantys = Parse.Object.extend("warranty");
var mBuilding = new Parse.Query(warrantys);
var consumerQuery = new Parse.Query(Parse.User);
$scope.consumerBuilding = function() {
var location = consumer.get("location");
mBuilding.withinMiles("location", location, "distance");
mBuilding.find({
success: function (proximalwarrantys){
console.log(proximalwarrantys);
}
})
}
$scope.consumerBuilding();
});
问题是传递给 withinMiles
函数的距离应该是一个数字而不是 "distance"
:
withinMiles(key, point, maxDistance)
Add a proximity based constraint for finding objects with key point values near the point given and within the maximum distance given. Radius of earth used is 3958.8 miles.
Parameters:
{String} key
The key that the Parse.GeoPoint is stored in.
{Parse.GeoPoint} point
The reference Parse.GeoPoint that is used.
{Number} maxDistance
Maximum distance (in miles) of results to return. Returns:
{Parse.Query}
Returns the query, so you can chain this call.