mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Added eachAsync options for concurrency (#20541)
* Added eachAsync options for concurrency * Added overload function definition for eachAsync
This commit is contained in:
Vendored
+17
-1
@@ -469,6 +469,11 @@ declare module "mongoose" {
|
||||
static Messages: Object;
|
||||
}
|
||||
|
||||
interface EachAsyncOptions {
|
||||
/** defaults to 1 */
|
||||
parallel?: number;
|
||||
}
|
||||
|
||||
/*
|
||||
* section querycursor.js
|
||||
* http://mongoosejs.com/docs/api.html#querycursor-js
|
||||
@@ -500,10 +505,21 @@ declare module "mongoose" {
|
||||
* Execute fn for every document in the cursor. If fn returns a promise,
|
||||
* will wait for the promise to resolve before iterating on to the next one.
|
||||
* Returns a promise that resolves when done.
|
||||
* @param callback executed when all docs have been processed
|
||||
* @param fn Function to be executed for every document in the cursor
|
||||
* @param callback Executed when all docs have been processed
|
||||
*/
|
||||
eachAsync(fn: (doc: T) => any, callback?: (err: any) => void): Promise<T>;
|
||||
|
||||
/**
|
||||
* Execute fn for every document in the cursor. If fn returns a promise,
|
||||
* will wait for the promise to resolve before iterating on to the next one.
|
||||
* Returns a promise that resolves when done.
|
||||
* @param fn Function to be executed for every document in the cursor
|
||||
* @param options Async options (e. g. parallel function execution)
|
||||
* @param callback Executed when all docs have been processed
|
||||
*/
|
||||
eachAsync(fn: (doc: T) => any, options: EachAsyncOptions, callback?: (err: any) => void): Promise<T>;
|
||||
|
||||
/**
|
||||
* Registers a transform function which subsequently maps documents retrieved
|
||||
* via the streams interface or .next()
|
||||
|
||||
Reference in New Issue
Block a user