Javascript ';失败:类型错误:无法调用方法';更换';未定义的';运行解析查询时
每当我运行我的解析后台作业时,它都会失败,并出现以下错误:Javascript ';失败:类型错误:无法调用方法';更换';未定义的';运行解析查询时,javascript,parse-platform,Javascript,Parse Platform,每当我运行我的解析后台作业时,它都会失败,并出现以下错误: Failed with: TypeError: Cannot call method 'replace' of undefined at Object.b.Query._quote (Parse.js:3:14236) at Object.b.Query.contains (Parse.js:3:14337) at main.js:1491:40 at e (Parse.js:2:5101) at
Failed with: TypeError: Cannot call method 'replace' of undefined
at Object.b.Query._quote (Parse.js:3:14236)
at Object.b.Query.contains (Parse.js:3:14337)
at main.js:1491:40
at e (Parse.js:2:5101)
at Parse.js:2:4651
at Array.forEach (native)
at Object.x.each.x.forEach [as _arrayEach] (Parse.js:1:665)
at c.extend.resolve (Parse.js:2:4602)
at null.<anonymous> (Parse.js:2:5181)
at e (Parse.js:2:5101)
我在这里所做的只是为查询设置参数,根本不涉及替换方法。是什么导致它将其声明为错误?我检查了三次,确定searchTermsList[I]存在,并且MCI_Results对象上的searchTerm属性也存在 对我来说,“解决办法”(我想“变通办法”更准确)是避免使用“contains”,而使用“containedIn”。这不是直觉,它应该工作,但它似乎做的把戏
我猜,当涉及到数组时,这两种方法都不是它们的名称所暗示的集合操作,而是它们只是寻找重叠,因此在contains和containedIn之间没有区别?我遇到了同样的问题-你明白了吗?
var MCI_Results = Parse.Object.extend("MCI_Results");
var MCI_Results_Comparison_Query = new Parse.Query(MCI_Results);
// Query for any MCI_Results that have new items
MCI_Results_Comparison_Query.equalTo('parent', parentUser);
MCI_Results_Comparison_Query.contains('searchTerm', searchTermsList[i]);
MCI_Results_Comparison_Query.containedIn('MCItems', top3List[i]);
MCI_Results_Comparison_Query.find()
.then(function(results) {
//No new items
if (results.length > 0) {
console.log("No new items, you're good to go!");
//Add user to the "DON'T send push notification" channel
////////
var installationQuery = new Parse.Query(Parse.Installation);
installationQuery.equalTo('userId', parentUser);
installationQuery.first()
.then(function(result) {
result.set('channels', ["noPush"]);
result.save();
});
///////
console.log('done updating channel');
}
//New items found
else if (results.length === 0) {
console.log('no matching MCI_Results, lets push some new shit');
console.log('searchTermsList[i]:' + searchTermsList[i]);
var MCI_Results_Update_Query = new Parse.Query(MCI_Results);
MCI_Results_Update_Query.equalTo('parent', parentUser);
MCI_Results_Update_Query.contains('searchTerm', searchTermsList[i]);