1
我在JavaScript中使用Parse查詢時遇到問題。我想嘗試使用多個doesNotMatchKeyInQuery函數,但它只允許使用最後一個函數。任何想法,我可以如何使代碼這樣的工作?忽略代碼其他部分可能存在的錯誤。我以此爲例解析多個doesNotMatchKeyInQuery
//Query 1
var Class1 = Parse.Object.extend("Class1");
var class1Query = new Parse.Query(Class1);
class1Query.equalTo("id", id1);
//Query 2
var Class2 = Parse.Object.extend("Class2");
var class2Query = new Parse.Query(Class2);
class2Query.equalTo("id", id2);
//Query 3
var Class3 = Parse.Object.extend("Class3");
var class3Query = new Parse.Query(Class3);
class3Query.equalTo("id", id3);
//Bringing it all together
var finalQuery = new Parse.Query("User");
//This is the part below I am talking about
finalQuery.doesNotMatchKeyInQuery("objectId", "id1", class1Query);
finalQuery.doesNotMatchKeyInQuery("objectId", "id2", class2Query);
finalQuery.doesNotMatchKeyInQuery("objectId", "id3", class3Query);
finalQuery.find({
success: function (results) {
response.success(results);
},
error: function (error) {
response.error(error);
}
});
我其實認爲這是行不通的。只有其中一個查詢是填充結果而不是所有的查詢。 – Midevilworm 2015-04-06 17:44:51
其實,我明白了。對於任何想知道每個.find方法的人來說,都需要在函數返回中附帶一個結果變量var。它看起來像這樣 ])。然後(功能(results1,results2,results3){ – Midevilworm 2015-04-06 17:51:40
@Midevilworm你能寫出完整的答案嗎? – Idan 2016-02-14 14:06:41