简体   繁体   中英

Javascript - Error: 102 bad type for inQuery Parse.com

When I run this code in the cloud I get bad inner query error when it should be matching results. Do the objectId's of the objects have to match?

Here is the code:

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);
     }

});

Would you try this? This will tell the query to compare the item object rather than the objectId. If it doesn't work, let me know.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM