Javascript - 错误:102错误类型的inQuery Parse.com

时间:2014-09-10 19:38:25

标签: javascript parse-platform cloud

当我在云中运行此代码时,如果应该匹配结果,则会出现内部查询错误。对象的objectId必须匹配吗?

以下是代码:

Parse.Cloud.define("itemsInfo", function(request, response) {


var TestItems = Parse.Object.extend("TestItem");
var UserFavorites = Parse.Object.extend("UserFavourite");

var testItemsQuery = new Parse.Query(TestItems);
var userFavoritesQuery = new Parse.Query(UserFavorites);
var installationQuery = new Parse.Query(Parse.Installation);

testItemsQuery.exists('item');
testItemsQuery.equalTo('school', 'Union College (NY)');

userFavoritesQuery.include('item'); //This makes sure to pull all of the favorite item data instead of just the pointer object
userFavoritesQuery.matchesQuery("item", testItemsQuery); //This will run this second query against the TestItems
//userFavoritesQuery.limit(1000); //limit results to 1000
//userFavoritesQuery.ascending('userId'); //group the user id's together in your array

userFavoritesQuery.find({
    success: function(results) {
        console.log(results);


     },
    error: function(error) {
            alert("Error: " + error.code + " " + error.message);
     }

});

1 个答案:

答案 0 :(得分:0)

你会试试吗?这将告诉查询比较项目对象而不是objectId。如果它不起作用,请告诉我。

userFavoritesQuery.matchesKeyInQuery('item', 'objectId', testItemsQuery);