Skip to content

Commit 88c03a1

Browse files
authored
feat(NODE-3489)!: remove cursor close options (#3505)
1 parent b4e63fb commit 88c03a1

File tree

3 files changed

+6
-21
lines changed

3 files changed

+6
-21
lines changed

etc/notes/CHANGES_5.0.0.md

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ The following is a detailed collection of the changes in the major v5 release of
1616

1717
## Changes
1818

19+
### `CursorCloseOptions` removed
20+
21+
When calling `close()` on a `Cursor`, no more options can be provided. This removes support for the
22+
`skipKillCursors` option that was unused.
23+
1924
### Snappy v7.x.x or later and optional peerDependency
2025

2126
`snappy` compression has been added to the package.json as a peerDependency that is **optional**.

src/cursor/abstract_cursor.ts

+1-20
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,6 @@ export const CURSOR_FLAGS = [
5858
'partial'
5959
] as const;
6060

61-
/** @public
62-
* @deprecated This interface is deprecated */
63-
export interface CursorCloseOptions {
64-
/** Bypass calling killCursors when closing the cursor. */
65-
/** @deprecated the skipKillCursors option is deprecated */
66-
skipKillCursors?: boolean;
67-
}
68-
6961
/** @public */
7062
export interface CursorStreamOptions {
7163
/** A transformation method applied to each document emitted by the stream */
@@ -447,18 +439,7 @@ export abstract class AbstractCursor<
447439
close(): Promise<void>;
448440
/** @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 */
449441
close(callback: Callback): void;
450-
/**
451-
* @deprecated options argument is deprecated
452-
*/
453-
close(options: CursorCloseOptions): Promise<void>;
454-
/**
455-
* @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
456-
*/
457-
close(options: CursorCloseOptions, callback: Callback): void;
458-
close(options?: CursorCloseOptions | Callback, callback?: Callback): Promise<void> | void {
459-
if (typeof options === 'function') (callback = options), (options = {});
460-
options = options ?? {};
461-
442+
close(callback?: Callback): Promise<void> | void {
462443
const needsToEmitClosed = !this[kClosed];
463444
this[kClosed] = true;
464445

src/index.ts

-1
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ export type { MONGO_CLIENT_EVENTS } from './constants';
257257
export type {
258258
AbstractCursorEvents,
259259
AbstractCursorOptions,
260-
CursorCloseOptions,
261260
CursorFlag,
262261
CursorStreamOptions
263262
} from './cursor/abstract_cursor';

0 commit comments

Comments
 (0)