Skip to content

Commit 556812f

Browse files
nbbeekendurran
andauthored
feat(NODE-3482)!: remove unref (#3494)
Co-authored-by: Durran Jordan <[email protected]>
1 parent 8fd1822 commit 556812f

File tree

4 files changed

+6
-21
lines changed

4 files changed

+6
-21
lines changed

etc/notes/CHANGES_5.0.0.md

+5
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ This means `npm` will let you know if the version of snappy you have installed i
2525
npm install --save snappy@7
2626
```
2727

28+
### `.unref()` removed from `Db`
29+
30+
The `.unref()` method was a no-op and has now been removed from the Db class.
31+
32+
2833
### @aws-sdk/credential-providers v3.201.0 or later and optional peerDependency
2934

3035
`@aws-sdk/credential-providers` has been added to the package.json as a peerDependency that is **optional**.

src/db.ts

-9
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ import {
4444
Callback,
4545
DEFAULT_PK_FACTORY,
4646
filterOptions,
47-
getTopology,
4847
MongoDBNamespace,
4948
resolveOptions
5049
} from './utils';
@@ -738,14 +737,6 @@ export class Db {
738737
);
739738
}
740739

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-
749740
/**
750741
* Create a new Change Stream, watching for new changes (insertions, updates,
751742
* replacements, deletions, and invalidations) in this database. Will ignore all

src/sdam/topology.ts

-8
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ import type { Transaction } from '../transactions';
3939
import {
4040
Callback,
4141
ClientMetadata,
42-
emitWarning,
4342
EventEmitterWithState,
4443
HostAddress,
4544
List,
@@ -711,13 +710,6 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
711710
return this.s.state === STATE_CLOSED;
712711
}
713712

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-
721713
// NOTE: There are many places in code where we explicitly check the last hello
722714
// to do feature support detection. This should be done any other way, but for
723715
// now we will just return the first hello seen, which should suffice.

test/types/mongodb.test-d.ts

+1-4
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)