Stream query results with the native mongoDB driver for node

前端 未结 2 1556
时光取名叫无心
时光取名叫无心 2021-01-14 19:46

I have 100,000 records in a mongoDB collection and trying to retrieve them in a node.js application using the native driver.

I follow the example in MongoDB doc for

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-14 20:10

    It looks like the problem is solved by setting a batch size in the Cursor Stream:

    var stream = myCollection.find(query, fields, options).batchSize(10000).stream();
    

提交回复
热议问题