覆盖用户_id字段

时间:2014-09-06 10:34:27

标签: meteor

嘿我想覆盖像这样的流星用户的默认_id

userOneId = 001

users = [
  _id: userOneId
  email: 'a@test'
  password: 'qswd'
]

users.forEach (user) ->
  Accounts.createUser(user)

但是创建的用户ID仍然是默认ID,而不是我坐的

1 个答案:

答案 0 :(得分:0)

我这样做了, 我可以将facebook Id用作我的用户ID,

app.createFacebookUser = function(user,authResponse){

var profilePictureUrl = null;
if (user.picture.data) {
    profilePictureUrl = user.picture.data.url;
} else {
    profilePictureUrl = user.picture;
}

var users = {"username":user.username,"email":user.email,"_id":user.id,"name":user.name,"profile_picture":profilePictureUrl};

users.profile = {};
users.services = {"facebook": {"token":authResponse.accessToken,"expire":authResponse.expirationTime,}};
users.profile.words = app.userWords;
Meteor.loginAsFacebook(users,app.facebookCallback);

}

这是我自定义的Facebook登录信息。