Skip to content

Commit a3aefdd

Browse files
committed
feat(NODE-3482)!: remove unref
1 parent e5b67f3 commit a3aefdd

File tree

4 files changed

+22
-19
lines changed

4 files changed

+22
-19
lines changed

etc/notes/CHANGES_5.0.0.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Changes in v5
2+
3+
## TOC
4+
5+
- TODO
6+
7+
## About
8+
9+
The following is a detailed collection of the changes in the major v5 release of the mongodb package for Node.js.
10+
11+
<!--
12+
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
13+
2. a brief statement of why we are breaking it (bug, not useful, inconsistent behavior, better alternative, etc)
14+
3. if applicable, an example of suggested syntax change (can be included in (1) )
15+
-->
16+
17+
## Changes
18+
19+
### `.unref()` removed from `Db`
20+
21+
The `.unref()` method was a no-op and has now been removed from the Db class.

src/db.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -738,14 +738,6 @@ export class Db {
738738
);
739739
}
740740

741-
/**
742-
* Unref all sockets
743-
* @deprecated This function is deprecated and will be removed in the next major version.
744-
*/
745-
unref(): void {
746-
getTopology(this).unref();
747-
}
748-
749741
/**
750742
* Create a new Change Stream, watching for new changes (insertions, updates,
751743
* replacements, deletions, and invalidations) in this database. Will ignore all

src/sdam/topology.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -711,13 +711,6 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
711711
return this.s.state === STATE_CLOSED;
712712
}
713713

714-
/**
715-
* @deprecated This function is deprecated and will be removed in the next major version.
716-
*/
717-
unref(): void {
718-
emitWarning('`unref` is a noop and will be removed in the next major version');
719-
}
720-
721714
// NOTE: There are many places in code where we explicitly check the last hello
722715
// to do feature support detection. This should be done any other way, but for
723716
// now we will just return the first hello seen, which should suffice.

test/types/mongodb.test-d.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import type { Document } from 'bson';
22
import { expectDeprecated, expectError, expectNotDeprecated, expectType } from 'tsd';
33

4-
import { Db, WithId, WriteConcern, WriteConcernSettings } from '../../src';
4+
import type { WithId, WriteConcern, WriteConcernSettings } from '../../src';
55
import * as MongoDBDriver from '../../src';
66
import type { ChangeStreamDocument } from '../../src/change_stream';
77
import { Collection } from '../../src/collection';
88
import type { AggregationCursor } from '../../src/cursor/aggregation_cursor';
99
import { FindCursor } from '../../src/cursor/find_cursor';
1010
import { MongoClient } from '../../src/mongo_client';
11-
import { Topology } from '../../src/sdam/topology';
1211

1312
// We wish to keep these APIs but continue to ensure they are marked as deprecated.
1413
expectDeprecated(Collection.prototype.insert);
@@ -17,8 +16,6 @@ expectDeprecated(Collection.prototype.remove);
1716
expectDeprecated(Collection.prototype.count);
1817
expectDeprecated(Collection.prototype.mapReduce);
1918
expectDeprecated(FindCursor.prototype.count);
20-
expectDeprecated(Topology.prototype.unref);
21-
expectDeprecated(Db.prototype.unref);
2219
expectDeprecated(MongoDBDriver.ObjectID);
2320
expectNotDeprecated(MongoDBDriver.ObjectId);
2421

0 commit comments

Comments
 (0)