我只在生产构建时出现以下错误。我已经在开发中测试了它的工作非常好。
Exception while invoking method 'createUser' MongoError: insertDocument :: caused by :: 11000 E11000 duplicate key error index: meteor.users.$emails.address_1 dup key: { : "damianmiles@gmail.com" }
at Object.Future.wait (/home/Steven/bundle/programs/server/node_modules/fibers/future.js:326:15)
at null.<anonymous> (packages/meteor/helpers.js:111)
at MongoConnection.(anonymous function) [as insert] (packages/mongo-livedata/mongo_driver.js:595)
at Meteor.Collection.(anonymous function) [as insert] (packages/mongo-livedata/collection.js:476)
at Object.Accounts.insertUserDoc (packages/accounts-base/accounts_server.js:1021)
at createUser (packages/accounts-password/password_server.js:557)
at packages/accounts-password/password_server.js:577
at tryLoginMethod (packages/accounts-base/accounts_server.js:171)
at Object.Accounts._loginMethod (packages/accounts-base/accounts_server.js:287)
at Meteor.methods.createUser (packages/accounts-password/password_server.js:563)
这是 /clients/lib/accounts.js 文件中的代码:
Template.register.events({
'submit #register-form' : function(e, t) {
e.preventDefault();
var name = t.find('#signupFullName').value,
email = trimInput(t.find('#signupEmail').value.toLowerCase()),
subdomain = t.find('#signupSubdomain').value,
password = t.find('#reenterpassword').value,
repassword = t.find('#reenterpassword').value;
if(password != repassword) {
alert('Password not matches');
}
if (isValidPassword(password) == false || isEmail(email) == false) {
return false;
}
Accounts.createUser({email: email, password: password, profile: {name: name}}, function(err) {
if (err) {
alert(err.message);
} else {
alert('Account has been created.');
Meteor.navigateTo('/ControlPanel');
$('#myModal').modal('hide');
}
});
return false;
}
}
});
开发:流星:0.8.1.1,Nodejs:v0.10.25
生产:MongoDB:2.6.1(32位),NodeJS:v0.10.26