deno.land / x / mongoose@6.7.5 / types / cursor.d.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
declare module 'mongoose' {
import stream = require('stream');
type CursorFlag = 'tailable' | 'oplogReplay' | 'noCursorTimeout' | 'awaitData' | 'partial';
interface EachAsyncOptions { parallel?: number; batchSize?: number; continueOnError?: boolean; }
class Cursor<DocType = any, Options = never> extends stream.Readable { [Symbol.asyncIterator](): AsyncIterableIterator<DocType>;
/** * Adds a [cursor flag](https://mongodb.github.io/node-mongodb-native/4.9/classes/FindCursor.html#addCursorFlag). * Useful for setting the `noCursorTimeout` and `tailable` flags. */ addCursorFlag(flag: CursorFlag, value: boolean): this;
/** * Marks this cursor as closed. Will stop streaming and subsequent calls to * `next()` will error. */ close(callback: CallbackWithoutResult): void; close(): Promise<void>;
/** * Execute `fn` for every document(s) in the cursor. If batchSize is provided * `fn` will be executed for each batch of documents. 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. */ eachAsync(fn: (doc: DocType[]) => any, options: EachAsyncOptions & { batchSize: number }, callback: CallbackWithoutResult): void; eachAsync(fn: (doc: DocType) => any, options: EachAsyncOptions, callback: CallbackWithoutResult): void; eachAsync(fn: (doc: DocType[]) => any, options: EachAsyncOptions & { batchSize: number }): Promise<void>; eachAsync(fn: (doc: DocType) => any, options?: EachAsyncOptions): Promise<void>;
/** * Registers a transform function which subsequently maps documents retrieved * via the streams interface or `.next()` */ map<ResultType>(fn: (res: DocType) => ResultType): Cursor<ResultType, Options>;
/** * Get the next document from this cursor. Will return `null` when there are * no documents left. */ next(callback: Callback<DocType | null>): void; next(): Promise<DocType>;
options: Options; }}
mongoose

Version Info

Tagged at
a year ago