Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/370.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript node.js处理管道结果_Javascript_Node.js_Mongodb - Fatal编程技术网

Javascript node.js处理管道结果

Javascript node.js处理管道结果,javascript,node.js,mongodb,Javascript,Node.js,Mongodb,我正在使用节点模块通过以下函数调用处理传入邮件: client.listMessages(-1, function(err, messages){ messages.forEach(function(message){ client.createMessageStream(message.UID) .pipe(process.stdout, {end: false}); }); }); 这会使用“process.stdout”将邮件

我正在使用节点模块通过以下函数调用处理传入邮件:

client.listMessages(-1, function(err, messages){
    messages.forEach(function(message){
        client.createMessageStream(message.UID)
              .pipe(process.stdout, {end: false});
    });
 });
这会使用“process.stdout”将邮件记录到控制台,但是我想将结果保存到mongo,或者执行其他javascript操作,我该怎么做呢?

似乎返回了一个对象。访问数据的方法显示在该链接中


在将数据保存到MongoDB时,有一些或模块可以为您提供执行此操作的方法。

我认为您不是在问mongoose/保存到DB-您是在问如何在函数外部获取消息?制作将数据保存到MongoDB的函数,并将消息扔到回调函数中的函数。这么难吗?