Here is my code :
UserManager.prototype.Insert = function (acc, pw, key, type) {
db.connect();
db.removeModel('tb_user');
var um = this.CreateModel();
um.find({ account: acc }).then(function (user) {
var new_user = new um({
account: acc, password: pw, api_key: key, admin: type
});
return new_user.save();
}).then(function (rs) {
console.log(rs);
});
}
i don't know why i cannot insert new record to database but i replace INSERT to UPDATE, this code working fine Please help me fix it Thanks all!
via Zard
No comments:
Post a Comment