Skip to content

Commit 5381d68

Browse files
authored
Merge branch 'main' into NODE-6473
2 parents 4378652 + b59c5ce commit 5381d68

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+1640
-1496
lines changed

.evergreen/config.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,17 +1860,6 @@ tasks:
18601860
- {key: NODE_LTS_VERSION, value: '22'}
18611861
- func: install dependencies
18621862
- func: run lint checks
1863-
- name: run-resource-management-async-dispose
1864-
tags:
1865-
- resource-management
1866-
commands:
1867-
- command: expansions.update
1868-
type: setup
1869-
params:
1870-
updates:
1871-
- {key: NODE_LTS_VERSION, value: '22'}
1872-
- func: install dependencies
1873-
- func: check resource management
18741863
- name: test-explicit-resource-management-feature-integration
18751864
tags:
18761865
- resource-management

.evergreen/generate_evergreen_tasks.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -510,17 +510,6 @@ SINGLETON_TASKS.push(
510510
{ func: 'run lint checks' }
511511
]
512512
},
513-
{
514-
name: 'run-resource-management-async-dispose',
515-
tags: ['resource-management'],
516-
commands: [
517-
updateExpansions({
518-
NODE_LTS_VERSION: LATEST_LTS
519-
}),
520-
{ func: 'install dependencies' },
521-
{ func: 'check resource management' }
522-
]
523-
},
524513
{
525514
name: 'test-explicit-resource-management-feature-integration',
526515
tags: ['resource-management'],

.evergreen/run-resource-management.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.

api-extractor.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
"dtsRollup": {
1111
"enabled": true,
1212
"untrimmedFilePath": "",
13-
"publicTrimmedFilePath": "<projectFolder>/<unscopedPackageName>.d.ts",
14-
"betaTrimmedFilePath": "<projectFolder>/lib/beta.d.ts"
13+
"publicTrimmedFilePath": "<projectFolder>/<unscopedPackageName>.d.ts"
1514
},
1615
"tsdocMetadata": {
1716
"enabled": false

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
"scripts": {
125125
"build:evergreen": "node .evergreen/generate_evergreen_tasks.js",
126126
"build:ts": "node ./node_modules/typescript/bin/tsc",
127-
"build:dts": "npm run build:ts && api-extractor run && node etc/clean_definition_files.cjs && ESLINT_USE_FLAT_CONFIG=false eslint --no-ignore --fix mongodb.d.ts lib/beta.d.ts",
127+
"build:dts": "npm run build:ts && api-extractor run && node etc/clean_definition_files.cjs && ESLINT_USE_FLAT_CONFIG=false eslint --no-ignore --fix mongodb.d.ts",
128128
"build:docs": "./etc/docs/build.ts",
129129
"build:typedoc": "typedoc",
130130
"build:nightly": "node ./.github/scripts/nightly.mjs",
@@ -143,7 +143,6 @@
143143
"check:unit": "nyc mocha test/unit",
144144
"check:ts": "node ./node_modules/typescript/bin/tsc -v && node ./node_modules/typescript/bin/tsc --noEmit",
145145
"check:atlas": "nyc mocha --config test/manual/mocharc.js test/manual/atlas_connectivity.test.ts",
146-
"check:resource-management": "nyc mocha --config test/manual/mocharc.js test/manual/resource_management.test.ts",
147146
"check:drivers-atlas-testing": "nyc mocha --config test/mocha_mongodb.js test/atlas/drivers_atlas_testing.test.ts",
148147
"check:aws": "nyc mocha --config test/mocha_mongodb.js test/integration/auth/mongodb_aws.test.ts",
149148
"check:oidc-auth": "nyc mocha --config test/mocha_mongodb.js test/integration/auth/auth.spec.test.ts",

src/beta.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

src/bulk/common.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import type { Topology } from '../sdam/topology';
2020
import { type Sort } from '../sort';
2121
import { TimeoutContext } from '../timeout';
2222
import {
23-
applyRetryableWrites,
2423
getTopology,
2524
hasAtomicOperators,
2625
maybeAddIdToDocuments,
@@ -527,15 +526,15 @@ async function executeCommands(
527526
finalOptions.checkKeys = false;
528527
}
529528

530-
if (finalOptions.retryWrites) {
529+
if (bulkOperation.retryWrites) {
531530
if (isUpdateBatch(batch)) {
532-
finalOptions.retryWrites =
533-
finalOptions.retryWrites && !batch.operations.some(op => op.multi);
531+
bulkOperation.retryWrites =
532+
bulkOperation.retryWrites && !batch.operations.some(op => op.multi);
534533
}
535534

536535
if (isDeleteBatch(batch)) {
537-
finalOptions.retryWrites =
538-
finalOptions.retryWrites && !batch.operations.some(op => op.limit === 0);
536+
bulkOperation.retryWrites =
537+
bulkOperation.retryWrites && !batch.operations.some(op => op.limit === 0);
539538
}
540539
}
541540

@@ -859,13 +858,16 @@ export abstract class BulkOperationBase {
859858
s: BulkOperationPrivate;
860859
operationId?: number;
861860
private collection: Collection;
861+
/** @internal */
862+
retryWrites?: boolean;
862863

863864
/**
864865
* Create a new OrderedBulkOperation or UnorderedBulkOperation instance
865866
* @internal
866867
*/
867868
constructor(collection: Collection, options: BulkWriteOptions, isOrdered: boolean) {
868869
this.collection = collection;
870+
this.retryWrites = collection.db.options?.retryWrites;
869871
// determine whether bulkOperation is ordered or unordered
870872
this.isOrdered = isOrdered;
871873

@@ -898,10 +900,6 @@ export abstract class BulkOperationBase {
898900
// + 1 bytes for null terminator
899901
const maxKeySize = (maxWriteBatchSize - 1).toString(10).length + 2;
900902

901-
// Final options for retryable writes
902-
let finalOptions = Object.assign({}, options);
903-
finalOptions = applyRetryableWrites(finalOptions, collection.db);
904-
905903
// Final results
906904
const bulkResult: BulkResult = {
907905
ok: 1,
@@ -943,7 +941,7 @@ export abstract class BulkOperationBase {
943941
// Topology
944942
topology,
945943
// Options
946-
options: finalOptions,
944+
options: options,
947945
// BSON options
948946
bsonOptions: resolveBSONOptions(options),
949947
// Current operation

src/change_stream.ts

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ import {
1717
import { MongoClient } from './mongo_client';
1818
import { type InferIdType, TypedEventEmitter } from './mongo_types';
1919
import type { AggregateOptions } from './operations/aggregate';
20-
import type { CollationOptions, OperationParent } from './operations/command';
21-
import type { ReadPreference } from './read_preference';
22-
import { type AsyncDisposable, configureResourceManagement } from './resource_management';
20+
import type { OperationParent } from './operations/command';
2321
import type { ServerSessionId } from './sessions';
2422
import { CSOTTimeoutContext, type TimeoutContext } from './timeout';
2523
import { filterOptions, getTopology, type MongoDBNamespace, squashError } from './utils';
@@ -45,21 +43,6 @@ const NO_RESUME_TOKEN_ERROR =
4543
'A change stream document has been received that lacks a resume token (_id).';
4644
const CHANGESTREAM_CLOSED_ERROR = 'ChangeStream is closed';
4745

48-
/**
49-
* @public
50-
* @deprecated Please use the ChangeStreamCursorOptions type instead.
51-
*/
52-
export interface ResumeOptions {
53-
startAtOperationTime?: Timestamp;
54-
batchSize?: number;
55-
maxAwaitTimeMS?: number;
56-
collation?: CollationOptions;
57-
readPreference?: ReadPreference;
58-
resumeAfter?: ResumeToken;
59-
startAfter?: ResumeToken;
60-
fullDocument?: string;
61-
}
62-
6346
/**
6447
* Represents the logical starting point for a new ChangeStream or resuming a ChangeStream on the server.
6548
* @see https://www.mongodb.com/docs/manual/changeStreams/#std-label-change-stream-resume
@@ -590,13 +573,10 @@ export class ChangeStream<
590573
implements AsyncDisposable
591574
{
592575
/**
593-
* @beta
594576
* @experimental
595577
* An alias for {@link ChangeStream.close|ChangeStream.close()}.
596578
*/
597-
declare [Symbol.asyncDispose]: () => Promise<void>;
598-
/** @internal */
599-
async asyncDispose() {
579+
async [Symbol.asyncDispose]() {
600580
await this.close();
601581
}
602582

@@ -1106,5 +1086,3 @@ export class ChangeStream<
11061086
}
11071087
}
11081088
}
1109-
1110-
configureResourceManagement(ChangeStream.prototype);

src/cmap/connect.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ export async function prepareHandshakeDocument(
222222
const options = authContext.options;
223223
const compressors = options.compressors ? options.compressors : [];
224224
const { serverApi } = authContext.connection;
225-
const clientMetadata: Document = await options.extendedMetadata;
225+
const clientMetadata: Document = await options.metadata;
226226

227227
const handshakeDoc: HandshakeDocument = {
228228
[serverApi?.version || options.loadBalanced === true ? 'hello' : LEGACY_HELLO_COMMAND]: 1,

src/cmap/connection.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ export interface ConnectionOptions
138138
tls: boolean;
139139
noDelay?: boolean;
140140
socketTimeoutMS?: number;
141+
/** @internal */
141142
cancellationToken?: CancellationToken;
142-
metadata: ClientMetadata;
143143
/** @internal */
144-
extendedMetadata: Promise<Document>;
144+
metadata: Promise<ClientMetadata>;
145145
/** @internal */
146146
mongoLogger?: MongoLogger | undefined;
147147
}

0 commit comments

Comments
 (0)