【发布时间】:2017-02-20 13:40:27
【问题描述】:
我正在尝试为用户创建通知。
在像这样http://localhost:1337/invited/accept?referrer=msgIcon&id=this-notification-id这样的描述中带有通知url,该url具有这个新创建的通知的id。
AppUserNotification.create({
projectId: projectId,
appuser: appusers.id,
notificationTitle: 'You are invited in project',
isRead: 0,
description: 'You are invited in project collaboration, '
+ 'please accept invitation by following the link.\nHave a good day !\n'
+ 'Accept Invitation http://localhost:1337/invited/accept?referrer=msgIcon&id=this-notification-id',
}).exec(function (err, appuserNotifications) {
apiStatus = 1; // heading toward success
if (err){
return false;
}else if(appuserNotifications){
return true;
}
});//</after AppUserNotification.create()>
我想要做的是用这个新创建的通知在描述中保存一个链接。但无法做到这一点。 请帮帮我。
【问题讨论】:
-
你不能那样做。 Id 来自数据库,因此只能在回调中访问。您可以在创建后更新它。
appuserNotifications.description = 'your desc with id'; appuserNotifications.save()
标签: javascript node.js mongodb sails.js