【发布时间】:2015-08-30 11:54:46
【问题描述】:
我试图了解以下函数中发生的情况:
next(err, err || doc._id)
我对此进行了一些研究,但找不到任何解释 next 函数的文档。有人能解释一下它的用途吗?
function createQuestions(storyPrettyId, questions, author, callback) {
async.map(
questions,
function(question, next) {
QuestionMongoModel.create({
storyPrettyId: storyPrettyId,
title: question.title,
answers: question.answers,
author: author
}, function(err, doc) {
next(err, err || doc._id)
})
},
callback
)
}
【问题讨论】:
-
感谢 Ram,这是我在该网站上的第一篇文章。感谢您向我展示它是如何完成的。
标签: node.js mongodb asynchronous express backend