Open class4cxy opened 8 years ago
Once the save
callback has executed, the instance you created should have its id property correctly assigned.
thanks for reply.
you means i can get the id from model instance ?
like this ?
var user = User.create(params);
user.save(function () { alert(user.id) })
i found the insertId
was return throught this.exec(sql, function (err, res) {
,but it dosen't return back to callback
, why ? how could i get the insertId
hi :
my question is after i call the model.save() method, how can i get the current model's id ? and mysql db is design to
auto_increment
. i was try to use"SELECT LAST_INSERT_ID() as id FROM "
after save's callback, but it dosen't suit when concurrent request