5
在afterSave雲代碼的功能如下:如何在Cloud Code中關注用戶鏈接?
Parse.Cloud.afterSave("Post", function (request) {
var post = request.object;
if (post.has('author')) {
var author = post.get('author');
// author is a Link to a specific Parse.User
}
}
我試圖讓分析用戶的郵件由郵政的作者字段指出。
在上述例子中,author
結束含有下列:
{
"__type":"Pointer",
"className":"_User",
"objectId":"413wgL9vf1"
}
從本質上講,我想讀的用戶的email
屬性由指針所指向。
我試過author.get('email')
,說失敗了,說「未定義」。該電子郵件在數據庫中設置。
什麼是正確的方法來做到這一點?我應該使用鏈接中的objectId來編寫一個針對User類的查詢,還是有更簡單的方法?