0
我想要在標籤爲type
的列中獲取值爲like
或dislike
的所有行。在我的移動代碼上,我使用了whereKey:"type" containsString:"like"
,但我無法弄清楚如何在Cloud Code中執行此操作。我搜索了文檔,但是我找不到任何信息。雲代碼 - containsString
我想要在標籤爲type
的列中獲取值爲like
或dislike
的所有行。在我的移動代碼上,我使用了whereKey:"type" containsString:"like"
,但我無法弄清楚如何在Cloud Code中執行此操作。我搜索了文檔,但是我找不到任何信息。雲代碼 - containsString
我在回答我自己的問題,因爲我很難找到這個問題,所以希望這可以加快未來搜索者的過程。
在Cloud Code中,有一個叫做contains
的函數,它和我提到的函數一樣。
var query = new Parse.Query("Activity");
query.contains("type", "like");
query.equalTo("user", request.user);
query.equalTo("photo", request.object.get("photo"));
query.count({
success: function(count) {
//User has no activity on photo
if(count == 0){
response.success();
}
//User already has a like or dislike on photo
else {
response.error();
}
},
error: function() {
response.error("like lookup failed");
}
});
你能提供你的代碼,以便我們可以從中學習嗎? – OXXY 2015-10-20 08:04:13
當然!剛添加我的代碼:) @OXXY – Dehli 2015-10-20 13:46:33
非常感謝你 – OXXY 2015-10-21 11:39:26