Skip to content

Commit

Permalink
feat(NODE-3482)!: remove unref (#3494)
Browse files Browse the repository at this point in the history
Co-authored-by: Durran Jordan <durran@gmail.com>
  • Loading branch information
nbbeeken and durran authored Dec 22, 2022
1 parent 8fd1822 commit 556812f
Show file tree
Hide file tree
Showing 4 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 @@ -25,6 +25,11 @@ This means `npm` will let you know if the version of snappy you have installed i
npm install --save snappy@7
```

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

The `.unref()` method was a no-op and has now been removed from the Db class.


### @aws-sdk/credential-providers v3.201.0 or later and optional peerDependency

`@aws-sdk/credential-providers` has been added to the package.json as a peerDependency that is **optional**.
Expand Down
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

0 comments on commit 556812f

Please sign in to comment.