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

feat(NODE-3489)!: remove cursor close options #3505

Merged
merged 3 commits into from
Jan 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 5 additions & 0 deletions etc/notes/CHANGES_5.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ The following is a detailed collection of the changes in the major v5 release of

## Changes

### `CursorCloseOptions` removed

When calling `close()` on a `Cursor`, no more options can be provided. This removes support for the
`skipKillCursors` option that was unused.

### Snappy v7.x.x or later and optional peerDependency

`snappy` compression has been added to the package.json as a peerDependency that is **optional**.
Expand Down
21 changes: 1 addition & 20 deletions src/cursor/abstract_cursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,6 @@ export const CURSOR_FLAGS = [
'partial'
] as const;

/** @public
* @deprecated This interface is deprecated */
export interface CursorCloseOptions {
/** Bypass calling killCursors when closing the cursor. */
/** @deprecated the skipKillCursors option is deprecated */
skipKillCursors?: boolean;
}

/** @public */
export interface CursorStreamOptions {
/** A transformation method applied to each document emitted by the stream */
Expand Down Expand Up @@ -447,18 +439,7 @@ export abstract class AbstractCursor<
close(): Promise<void>;
/** @deprecated Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance */
close(callback: Callback): void;
/**
* @deprecated options argument is deprecated
*/
close(options: CursorCloseOptions): Promise<void>;
/**
* @deprecated options argument is deprecated. Callbacks are deprecated and will be removed in the next major version. See [mongodb-legacy](https://github.com/mongodb-js/nodejs-mongodb-legacy) for migration assistance
*/
close(options: CursorCloseOptions, callback: Callback): void;
close(options?: CursorCloseOptions | Callback, callback?: Callback): Promise<void> | void {
if (typeof options === 'function') (callback = options), (options = {});
options = options ?? {};

close(callback?: Callback): Promise<void> | void {
const needsToEmitClosed = !this[kClosed];
this[kClosed] = true;

Expand Down
1 change: 0 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ export type { MONGO_CLIENT_EVENTS } from './constants';
export type {
AbstractCursorEvents,
AbstractCursorOptions,
CursorCloseOptions,
CursorFlag,
CursorStreamOptions
} from './cursor/abstract_cursor';
Expand Down