Iterate a Mongodb cursor and handle results concurrently, up to a set limit
Useful when you do not want to load the whole collection in memory.
npm install --save process-cursor-concurrently
const processCursorConcurrently = require('process-cursor-concurrently')
const cursor = collection.find()
const handler = async doc => { /* do some work */ }
await processCursorConcurrently(cursor, handler, {concurrency: 10})
Type: async function
Returns: {countProcessed: number}
Type: mongodb.Cursor
A mongodb cursor instance
Type: async function
The function that will be called with each document
Type: object
Type: number
The maximum number of times that the handler function will be called concurrently.
Type: function
Optional. A function that will be called each time an item is processed.