当我在云中运行此代码时,如果应该匹配结果,则会出现内部查询错误。对象的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);
}
});
答案 0 :(得分:0)
userFavoritesQuery.matchesKeyInQuery('item', 'objectId', testItemsQuery);