使用accounts-password手动从种子文件插入用户

stu*_*oid 1 meteor

有没有办法将用户加入帐户密码?就像是:

  Users.insert
    email: 'test@test.com'
    password: 'secret'
Run Code Online (Sandbox Code Playgroud)

我尝试了很多东西,但没有运气.在此先感谢您的帮助

Dav*_*don 9

启动时在服务器上执行此操作最简单:

Meteor.startup(function() {
  if (Meteor.users.find().count() === 0) {
    Accounts.createUser({
      username: 'test',
      email: 'test@example.com',
      password: 'password'
    });
  }
});
Run Code Online (Sandbox Code Playgroud)