Skip to content

Commit

Permalink
feat(NODE-3489): remove cursor close options
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed Dec 28, 2022
1 parent 30c0aee commit b1be594
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 21 deletions.
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

0 comments on commit b1be594

Please sign in to comment.