2013-08-01 2 views

답변

1

당신은 하나 user.field 또는 user.profile.field에, 서버 측에서 사용자 생성을 구성하면 사용자 데이터베이스 문서를 초기화 할 수 있습니다이 함수에서 Accounts.onCreateUser on docs.meteor.com

을보고 설정에 사용자 정의 기능이 필요합니다. 사용자 이름은 user.username에 자동으로 저장되므로 사용자가 만들 필요가 없습니다.

그런 다음 사용자 레코드의 클라이언트 측을 수정, 단순히 Meteor.users 수집을 업데이트하는 서버 방법, 즉 전화

서버/users.js

Meteor.methods({ 
    updateUser:function(fields){ 
     if(!this.userId){ 
      // error : no user logged in 
     } 
     check(fields,{/* fields verification */}); 
     Meteor.users.update(this.userId,{ 
      $set:fields 
     }); 
    } 
}); 

클라이언트/main.js

유성 내장 된 사용자 계정
Meteor.call("updateUser",{ 
    "username":"foo", 
    "profile.bar":"bar" 
}); 

참고 크게이 모든 과정을 단순화 : 그것을 잘 설명되어 있습니다 그래서 당신은 문서의 특정 부분을 다시 읽어 보시기 바랍니다.

관련 문제