Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make tryNext and Batch public #2675

Merged
merged 7 commits into from
Dec 16, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bulk/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export interface BulkResult {
* Keeps the state of a unordered batch so we can rewrite the results
* correctly after command execution
*
* @internal
* @public
*/
export class Batch {
originalZeroIndex: number;
Expand Down
7 changes: 7 additions & 0 deletions src/change_stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,13 @@ export class ChangeStream extends EventEmitter {
}
return this.cursor.stream(options);
}

tryNext(): Promise<Document | null> {
if (!this.cursor) {
mbroadst marked this conversation as resolved.
Show resolved Hide resolved
throw new MongoError('ChangeStream has no cursor, unable to tryNext');
}
return this.cursor.tryNext();
}
}

/** @internal */
Expand Down
1 change: 0 additions & 1 deletion src/cursor/abstract_cursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ export abstract class AbstractCursor extends EventEmitter {

/**
* Try to get the next available document from the cursor or `null` if an empty batch is returned
* @internal
*/
tryNext(): Promise<Document | null>;
tryNext(callback: Callback<Document | null>): void;
Expand Down