Added forEach variant returning promise

According to line 731 in [source](http://mongodb.github.io/node-mongodb-native/3.1/api/lib_cursor.js.html), callback is optional and if not provided, the fuction returns Promise
This commit is contained in:
Viktor Taranenko
2018-08-09 17:55:39 +01:00
committed by GitHub
parent 5ead03ec10
commit 21df98f98f

View File

@@ -1268,6 +1268,7 @@ export class Cursor<T = Default> extends Readable {
filter(filter: Object): Cursor<T>;
/** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#forEach */
forEach(iterator: IteratorCallback<T>, callback: EndCallback): void;
forEach(iterator: IteratorCallback<T>): Promise<void>;
/** http://mongodb.github.io/node-mongodb-native/3.1/api/Cursor.html#hasNext */
hasNext(): Promise<boolean>;
hasNext(callback: MongoCallback<boolean>): void;