从服务器获取当前用户 ID

Getting currentUser id from server

我正在尝试在使用 meteor-uploads 上传文件后更新用户 "photoPath" 字段。 我收到此错误:

Error: Meteor code must always run within a Fiber. Try wrapping callbacks that you pass to non-Meteor libraries with Meteor.bindEnvironment.

server/init.js

validateFile: function(file, req) {
    Meteor.users.update( { _id: Meteor.userId() }, {$set: {"profile.photoPath": req.path}});

    return null; 
}

你应该使用
this.userId 从服务器端访问用户