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-3482)!: remove unref #3494

Merged
merged 4 commits into from
Dec 22, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
21 changes: 21 additions & 0 deletions etc/notes/CHANGES_5.0.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Changes in v5

## TOC

- TODO

## About

The following is a detailed collection of the changes in the major v5 release of the mongodb package for Node.js.

<!--
1. a brief statement of what is breaking (brief as in "x will now return y instead of z", or "x is no longer supported, use y instead", etc
2. a brief statement of why we are breaking it (bug, not useful, inconsistent behavior, better alternative, etc)
3. if applicable, an example of suggested syntax change (can be included in (1) )
-->

## Changes

### `.unref()` removed from `Db`

The `.unref()` method was a no-op and has now been removed from the Db class.
9 changes: 0 additions & 9 deletions src/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ import {
Callback,
DEFAULT_PK_FACTORY,
filterOptions,
getTopology,
MongoDBNamespace,
resolveOptions
} from './utils';
Expand Down Expand Up @@ -738,14 +737,6 @@ export class Db {
);
}

/**
* Unref all sockets
* @deprecated This function is deprecated and will be removed in the next major version.
*/
unref(): void {
getTopology(this).unref();
}

/**
* Create a new Change Stream, watching for new changes (insertions, updates,
* replacements, deletions, and invalidations) in this database. Will ignore all
Expand Down
8 changes: 0 additions & 8 deletions src/sdam/topology.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import type { Transaction } from '../transactions';
import {
Callback,
ClientMetadata,
emitWarning,
EventEmitterWithState,
HostAddress,
List,
Expand Down Expand Up @@ -711,13 +710,6 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
return this.s.state === STATE_CLOSED;
}

/**
* @deprecated This function is deprecated and will be removed in the next major version.
*/
unref(): void {
emitWarning('`unref` is a noop and will be removed in the next major version');
}

// NOTE: There are many places in code where we explicitly check the last hello
// to do feature support detection. This should be done any other way, but for
// now we will just return the first hello seen, which should suffice.
Expand Down
5 changes: 1 addition & 4 deletions test/types/mongodb.test-d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import type { Document } from 'bson';
import { expectDeprecated, expectError, expectNotDeprecated, expectType } from 'tsd';

import { Db, WithId, WriteConcern, WriteConcernSettings } from '../../src';
import type { WithId, WriteConcern, WriteConcernSettings } from '../../src';
import * as MongoDBDriver from '../../src';
import type { ChangeStreamDocument } from '../../src/change_stream';
import { Collection } from '../../src/collection';
import type { AggregationCursor } from '../../src/cursor/aggregation_cursor';
import { FindCursor } from '../../src/cursor/find_cursor';
import { MongoClient } from '../../src/mongo_client';
import { Topology } from '../../src/sdam/topology';

// We wish to keep these APIs but continue to ensure they are marked as deprecated.
expectDeprecated(Collection.prototype.insert);
Expand All @@ -17,8 +16,6 @@ expectDeprecated(Collection.prototype.remove);
expectDeprecated(Collection.prototype.count);
expectDeprecated(Collection.prototype.mapReduce);
expectDeprecated(FindCursor.prototype.count);
expectDeprecated(Topology.prototype.unref);
expectDeprecated(Db.prototype.unref);
expectDeprecated(MongoDBDriver.ObjectID);
expectNotDeprecated(MongoDBDriver.ObjectId);

Expand Down