且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

猫鼬更新/ upsert?

更新时间:2023-11-09 21:02:16

var reg_handler = function (act) {
  UserModel.update({ $or: [{nick: act.nick}, {hmask: act.host}] }, { $set: { lastfm: act.params } }, { upsert: true }, function(){});
};

这正是我想要的,而且它是一行。 :D完美!

This does exactly what I wanted, and it's one line. :D Perfect!