0
이 코드의 잘못된 점은 무엇입니까? "서버"폴더 안에 있습니다. 여기서 11 행은 오류 로그에서 호출됩니다.Meteor.users 컬렉션이 서버에서 정의되지 않았습니다.
import { Accounts } from 'meteor/accounts-base';
import generatePincode from '../../../utils/generate-pincode';
import Meteor from 'meteor/meteor';
Accounts.onCreateUser((options, user) => {
const customizedUser = Object.assign({
'pincode': generatePincode(4),
}, user);
// check that the pincode doesn't already exist
const existingUser = Meteor.users.findOne({
'pincode': customizedUser.pincode,
});
if (existingUser) {
throw new Meteor.Error(500,
'Duplicate pincode generated, please try again.');
}
// We still want the default hook's 'profile' behavior.
if (options.profile) {
customizedUser.profile = options.profile;
}
return customizedUser;
});
터미널 (서버) 로그 :
Exception while invoking method 'createUser' TypeError: Cannot read property 'findOne' of undefined
는 몽고 쉘 액세스 db.users입니까? – Jankapunkt