2016-04-11 19 views

cevap

0

Neden değil? akışı kullanın ve istediğiniz yere gönderin, örneğin:

var stream = model.aggregate([ 
     { 
      $match: { 
       // query... 
      } 
     }, 
     { 
      $project: { 
       _id  : 0, 
       field : 1 
      } 
     } 
    ]).cursor({ batchSize: 5000 }).exec().stream(); 

stream.on('data', function (doc) { 
    // do whatever you want with the data 
}).on('error', function (err) { 
    // handle errors 
}).on('end', function() { 
    // close files 
}); 
+0

var stream = Sfb.find ({process_id: processid}). Bunun için en hızlı sorgu ne olmalı ... ??? –

+0

Tabi ki daha hızlı olan 'find 'özelliğini de kullanabilirsiniz: http://mongoosejs.com/docs/api.html#querystream_QueryStream – TomG

İlgili konular