まだnode.jsが新しく、ここの配列はIDのリストで構成されています。私は、foreachループからの応答を送信していたとき、私はそれをググError: Can't set headers after they are sent.
を取得していますが、正しくので、ループのエラー:forEachループから送信された後にヘッダーを設定できません。
array.forEach(function(data) {
db.collection.find({
_id: mongoskin.helper.toObjectID(data)
}).toArray(function(err, data1) {
if (err) return next(err);
console.log(data1);
res.send(data1);
})
})
これをチェックアウトhttp://stackoverflow.com/questions/7042340/node-js-error-cant-set-headers-after-they-are-sent – vineet