Skip to content

Commit ede31fd

Browse files
authored
Merge branch 'main' into NODE-7223-v2
2 parents 1c70d3a + cfbada6 commit ede31fd

Some content is hidden

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

57 files changed

+1194
-874
lines changed

.evergreen/config.in.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,9 @@ functions:
617617
export AWS_ACCESS_KEY_ID=${aws_key}
618618
export AWS_SECRET_ACCESS_KEY=${aws_secret}
619619
620+
# use Node20
621+
export PATH=/opt/devtools/node20/bin:/opt/dev/tools/bin:$PATH
622+
620623
# Download all the task coverage files.
621624
# NOTE: All coverage files are too large for V8 to handle the resulting call to
622625
# JSON.stringify from within nyc, so with stick to Fermiun to include the

.evergreen/config.yml

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,9 @@ functions:
556556
export AWS_ACCESS_KEY_ID=${aws_key}
557557
export AWS_SECRET_ACCESS_KEY=${aws_secret}
558558
559+
# use Node20
560+
export PATH=/opt/devtools/node20/bin:/opt/dev/tools/bin:$PATH
561+
559562
# Download all the task coverage files.
560563
# NOTE: All coverage files are too large for V8 to handle the resulting call to
561564
# JSON.stringify from within nyc, so with stick to Fermiun to include the
@@ -1994,24 +1997,6 @@ tasks:
19941997
- func: install mongodb-client-encryption from source
19951998
- func: assume secrets manager role
19961999
- func: run custom csfle tests
1997-
- name: test-latest-driver-mongodb-client-encryption-6.0.0
1998-
tags:
1999-
- run-custom-dependency-tests
2000-
commands:
2001-
- command: expansions.update
2002-
type: setup
2003-
params:
2004-
updates:
2005-
- {key: NODE_LTS_VERSION, value: 20.19.0}
2006-
- {key: VERSION, value: '7.0'}
2007-
- {key: TOPOLOGY, value: replica_set}
2008-
- {key: CLIENT_ENCRYPTION, value: 'true'}
2009-
- func: install dependencies
2010-
- func: bootstrap mongo-orchestration
2011-
- func: install package
2012-
vars:
2013-
2014-
- func: run tests
20152000
- name: test-alpine-fle
20162001
tags:
20172002
- alpine-fle
@@ -3205,7 +3190,6 @@ buildvariants:
32053190
- run-custom-csfle-tests-5.0
32063191
- run-custom-csfle-tests-rapid
32073192
- run-custom-csfle-tests-latest
3208-
- test-latest-driver-mongodb-client-encryption-6.0.0
32093193
- name: rhel8-test-gcp-kms
32103194
display_name: GCP KMS Test
32113195
run_on: debian11-small

.evergreen/generate_evergreen_tasks.js

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -623,27 +623,28 @@ for (const serverVersion of ['5.0', 'rapid', 'latest']) {
623623
});
624624
}
625625

626-
customDependencyTests.push({
627-
name: `test-latest-driver-mongodb-client-encryption-6.0.0`,
628-
tags: ['run-custom-dependency-tests'],
629-
commands: [
630-
updateExpansions({
631-
NODE_LTS_VERSION: LOWEST_LTS,
632-
VERSION: '7.0',
633-
TOPOLOGY: 'replica_set',
634-
CLIENT_ENCRYPTION: true
635-
}),
636-
{ func: 'install dependencies' },
637-
{ func: 'bootstrap mongo-orchestration' },
638-
{
639-
func: 'install package',
640-
vars: {
641-
PACKAGE: '[email protected]'
642-
}
643-
},
644-
{ func: 'run tests' }
645-
]
646-
});
626+
// TODO(NODE-6997): update to 7.0.0 after release
627+
// customDependencyTests.push({
628+
// name: `test-latest-driver-mongodb-client-encryption-6.0.0`,
629+
// tags: ['run-custom-dependency-tests'],
630+
// commands: [
631+
// updateExpansions({
632+
// NODE_LTS_VERSION: LOWEST_LTS,
633+
// VERSION: '7.0',
634+
// TOPOLOGY: 'replica_set',
635+
// CLIENT_ENCRYPTION: true
636+
// }),
637+
// { func: 'install dependencies' },
638+
// { func: 'bootstrap mongo-orchestration' },
639+
// {
640+
// func: 'install package',
641+
// vars: {
642+
// PACKAGE: '[email protected]'
643+
// }
644+
// },
645+
// { func: 'run tests' }
646+
// ]
647+
// });
647648

648649
const coverageTask = {
649650
name: 'download and merge coverage'.split(' ').join('-'),

.evergreen/install-mongodb-client-encryption.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ rm -rf mongodb-client-encryption
1212
git clone https://github.com/mongodb-js/mongodb-client-encryption.git
1313
pushd mongodb-client-encryption
1414

15-
# TODO(NODE-7218): test against latest mongodb-client-encryption
16-
git checkout aa61a35f5e174cd1c1e247e036093e18c88268c6
15+
git checkout main
1716

1817
node --version
1918
npm --version

package-lock.json

Lines changed: 63 additions & 53 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"@mongodb-js/zstd": "^1.1.0 || ^2.0.0",
3535
"gcp-metadata": "^5.2.0",
3636
"kerberos": "^2.0.1",
37-
"mongodb-client-encryption": ">=6.0.0 <7",
37+
"mongodb-client-encryption": "^7.0.0-alpha",
3838
"snappy": "^7.3.2",
3939
"socks": "^2.7.1"
4040
},
@@ -96,7 +96,7 @@
9696
"js-yaml": "^4.1.0",
9797
"mocha": "^11.7.1",
9898
"mocha-sinon": "^2.1.2",
99-
"mongodb-client-encryption": "^6.5.0",
99+
"mongodb-client-encryption": "^7.0.0-alpha.1",
100100
"mongodb-legacy": "^6.1.3",
101101
"nyc": "^15.1.0",
102102
"prettier": "^3.6.2",
@@ -174,4 +174,4 @@
174174
"moduleResolution": "node"
175175
}
176176
}
177-
}
177+
}

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: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +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';
20+
import type { OperationParent } from './operations/command';
2221
import { type AsyncDisposable, configureResourceManagement } from './resource_management';
2322
import type { ServerSessionId } from './sessions';
2423
import { CSOTTimeoutContext, type TimeoutContext } from './timeout';
@@ -45,21 +44,6 @@ const NO_RESUME_TOKEN_ERROR =
4544
'A change stream document has been received that lacks a resume token (_id).';
4645
const CHANGESTREAM_CLOSED_ERROR = 'ChangeStream is closed';
4746

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-
6347
/**
6448
* Represents the logical starting point for a new ChangeStream or resuming a ChangeStream on the server.
6549
* @see https://www.mongodb.com/docs/manual/changeStreams/#std-label-change-stream-resume

0 commit comments

Comments
 (0)