我知道我notifications
的{{1}}字段中有对象,但当我在user
上调用时,它们正在消失。
notifications
User.findById(socket.request.user._id).populate('notifications').exec(function(err, user) {
console.log('get notification populated user', user);
var unread = user.unread;
var notifications = user.notifications;
socket.emit('take notifications', {
notifications: notifications,
num_unread: unread
});
});