_ = require("underscore")
var model = new Example(_.extend({ userId: req.user._id }, req.body))
または、userIdをreq.bodyにコピーする場合:
var model = new Example(_.extend(req.body, { userId: req.user._id }))
_ = require("underscore")
var model = new Example(_.extend({ userId: req.user._id }, req.body))
または、userIdをreq.bodyにコピーする場合:
var model = new Example(_.extend(req.body, { userId: req.user._id }))