mongo-each
Queued asynchronous iterating over mongodb cursor
API
each(cursor, iteratee, [options])
cursor
- a mongodb cursoriteratee
-function(doc)
- iteratee function, should return promiseoptions
- optionalconcurrency
- how manyiteratee
functions should be run in parallel (default:100
)batch
- batch mode (default:false
)batchSize
- batch size (default:10
)
Returns promise which is resolves when all iteratee functions have finished, or rejects if an error occurs
Example
const MongoClient = ;const each = ; { const db = await MongoClient; const collection = db; const cursor = collection; await ;} { return { ; };} ;
License
MIT