diff --git a/.evergreen.yml b/.evergreen.yml index 5ea5ce06b6..64398e5e10 100644 --- a/.evergreen.yml +++ b/.evergreen.yml @@ -9097,6 +9097,8 @@ tasks: node_js_version: "16.20.1" npm_deps_mode: all - func: test_connectivity + vars: + node_js_version: "16.20.1" - name: test_apistrict tags: ["extra-integration-test"] depends_on: diff --git a/.evergreen/evergreen.yml.in b/.evergreen/evergreen.yml.in index 1b14a05386..65f0124e77 100644 --- a/.evergreen/evergreen.yml.in +++ b/.evergreen/evergreen.yml.in @@ -794,6 +794,8 @@ tasks: node_js_version: "<% out(NODE_JS_VERSION_16) %>" npm_deps_mode: all - func: test_connectivity + vars: + node_js_version: "<% out(NODE_JS_VERSION_16) %>" - name: test_apistrict tags: ["extra-integration-test"] depends_on: diff --git a/.evergreen/install-node.sh b/.evergreen/install-node.sh index 6e3e5d4cde..2269dc812f 100755 --- a/.evergreen/install-node.sh +++ b/.evergreen/install-node.sh @@ -31,8 +31,11 @@ else [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" + set +x # nvm is very verbose + echo nvm install --no-progress $NODE_JS_VERSION && nvm alias default $NODE_JS_VERSION nvm install --no-progress $NODE_JS_VERSION nvm alias default $NODE_JS_VERSION + set -x if env PATH="/opt/chefdk/gitbin:$PATH" git --version | grep -q 'git version 1.'; then (cd "$BASEDIR" && diff --git a/.evergreen/setup-env.sh b/.evergreen/setup-env.sh index d4475a2d58..f7eb7c4caa 100755 --- a/.evergreen/setup-env.sh +++ b/.evergreen/setup-env.sh @@ -11,7 +11,10 @@ if [ "$OS" != "Windows_NT" ]; then export NVM_DIR="$HOME/.nvm" echo "Setting NVM environment home: $NVM_DIR" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + set +x # nvm is very verbose + echo nvm use $NODE_JS_VERSION nvm use $NODE_JS_VERSION + set -x export PATH="$NVM_BIN:$PATH" export CC=gcc diff --git a/package-lock.json b/package-lock.json index dd43593d49..97626296b5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,7 +32,7 @@ "husky": "^8.0.3", "lerna": "^4.0.0", "mocha": "^10.2.0", - "mongodb": "^5.6.0", + "mongodb": "^5.7.0", "node-gyp": "^9.0.0", "nyc": "^15.1.0", "pkg-up": "^3.1.0", @@ -13466,9 +13466,9 @@ } }, "node_modules/bson": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/bson/-/bson-5.3.0.tgz", - "integrity": "sha512-ukmCZMneMlaC5ebPHXIkP8YJzNl5DC41N5MAIvKDqLggdao342t4McltoJBQfQya/nHBWAcSsYRqlXPoQkTJag==", + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/bson/-/bson-5.4.0.tgz", + "integrity": "sha512-WRZ5SQI5GfUuKnPTNmAYPiKIof3ORXAF4IRU5UcgmivNIon01rWQlw5RUH954dpu8yGL8T59YShVddIPaU/gFA==", "engines": { "node": ">=14.20.1" } @@ -22024,11 +22024,11 @@ } }, "node_modules/mongodb": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-5.6.0.tgz", - "integrity": "sha512-z8qVs9NfobHJm6uzK56XBZF8XwM9H294iRnB7wNjF0SnY93si5HPziIJn+qqvUR5QOff/4L0gCD6SShdR/GtVQ==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-5.7.0.tgz", + "integrity": "sha512-zm82Bq33QbqtxDf58fLWBwTjARK3NSvKYjyz997KSy6hpat0prjeX/kxjbPVyZY60XYPDNETaHkHJI2UCzSLuw==", "dependencies": { - "bson": "^5.3.0", + "bson": "^5.4.0", "mongodb-connection-string-url": "^2.6.0", "socks": "^2.7.1" }, @@ -22040,6 +22040,8 @@ }, "peerDependencies": { "@aws-sdk/credential-providers": "^3.201.0", + "@mongodb-js/zstd": "^1.1.0", + "kerberos": "^2.0.1", "mongodb-client-encryption": ">=2.3.0 <3", "snappy": "^7.2.2" }, @@ -22047,6 +22049,12 @@ "@aws-sdk/credential-providers": { "optional": true }, + "@mongodb-js/zstd": { + "optional": true + }, + "kerberos": { + "optional": true + }, "mongodb-client-encryption": { "optional": true }, @@ -29878,7 +29886,7 @@ "@mongodb-js/tsconfig-mongosh": "^1.0.0", "depcheck": "^1.4.3", "eslint": "^7.25.0", - "mongodb": "^5.6.0", + "mongodb": "^5.7.0", "prettier": "^2.8.8" }, "engines": { @@ -30253,7 +30261,7 @@ "eslint": "^7.25.0", "lodash": "^4.17.21", "moment": "^2.29.1", - "mongodb": "^5.6.0", + "mongodb": "^5.7.0", "mongodb-crypt-library-dummy": "^1.0.2", "node-fetch": "^2.6.1", "prettier": "^2.8.8", @@ -30574,7 +30582,7 @@ "@aws-sdk/credential-providers": "^3.347.1", "@mongosh/errors": "0.0.0-dev.0", "bson": "^5.3.0", - "mongodb": "^5.6.0", + "mongodb": "^5.7.0", "mongodb-build-info": "^1.6.2" }, "devDependencies": { @@ -30603,9 +30611,9 @@ "@mongosh/types": "0.0.0-dev.0", "@types/sinon-chai": "^3.2.4", "aws4": "^1.11.0", - "mongodb": "^5.6.0", + "mongodb": "^5.7.0", "mongodb-connection-string-url": "^2.6.0", - "saslprep": "git+ssh://git@github.com/mongodb-js/saslprep.git#9813a626d0685f54e4f2fac6160470d6e01d8c96" + "saslprep": "mongodb-js/saslprep#v1.0.4" }, "devDependencies": { "@mongodb-js/eslint-config-mongosh": "^1.0.0", @@ -30643,7 +30651,7 @@ "bson": "^5.3.0", "depcheck": "^1.4.3", "eslint": "^7.25.0", - "mongodb": "^5.6.0", + "mongodb": "^5.7.0", "prettier": "^2.8.8", "semver": "^7.5.3" }, @@ -30717,7 +30725,7 @@ "@mongodb-js/tsconfig-mongosh": "^1.0.0", "depcheck": "^1.4.3", "eslint": "^7.25.0", - "mongodb": "^5.6.0", + "mongodb": "^5.7.0", "prettier": "^2.8.8" }, "engines": { @@ -39014,7 +39022,7 @@ "@mongosh/i18n": "0.0.0-dev.0", "depcheck": "^1.4.3", "eslint": "^7.25.0", - "mongodb": "^5.6.0", + "mongodb": "^5.7.0", "mongodb-connection-string-url": "^2.6.0", "prettier": "^2.8.8" } @@ -39294,7 +39302,7 @@ "lodash": "^4.17.21", "macos-export-certificate-and-key": "^1.1.1", "moment": "^2.29.1", - "mongodb": "^5.6.0", + "mongodb": "^5.7.0", "mongodb-connection-string-url": "^2.6.0", "mongodb-crypt-library-dummy": "^1.0.2", "mongodb-crypt-library-version": "^1.0.3", @@ -39519,8 +39527,8 @@ "bson": "^5.3.0", "depcheck": "^1.4.3", "eslint": "^7.25.0", - "mongodb": "^5.6.0", - "mongodb-build-info": "1.6.2", + "mongodb": "^5.7.0", + "mongodb-build-info": "^1.6.2", "mongodb-client-encryption": "^2.8.0", "prettier": "^2.8.8" } @@ -39540,11 +39548,11 @@ "depcheck": "^1.4.3", "eslint": "^7.25.0", "kerberos": "^2.0.0", - "mongodb": "^5.6.0", + "mongodb": "^5.7.0", "mongodb-client-encryption": "^2.8.0", "mongodb-connection-string-url": "^2.6.0", "prettier": "^2.8.8", - "saslprep": "git+ssh://git@github.com/mongodb-js/saslprep.git#9813a626d0685f54e4f2fac6160470d6e01d8c96" + "saslprep": "mongodb-js/saslprep#v1.0.4" } }, "@mongosh/shell-api": { @@ -39562,7 +39570,7 @@ "bson": "^5.3.0", "depcheck": "^1.4.3", "eslint": "^7.25.0", - "mongodb": "^5.6.0", + "mongodb": "^5.7.0", "mongodb-redact": "^0.2.2", "prettier": "^2.8.8", "semver": "^7.5.3" @@ -39616,7 +39624,7 @@ "@mongodb-js/tsconfig-mongosh": "^1.0.0", "depcheck": "^1.4.3", "eslint": "^7.25.0", - "mongodb": "^5.6.0", + "mongodb": "^5.7.0", "prettier": "^2.8.8" } }, @@ -42502,9 +42510,9 @@ } }, "bson": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/bson/-/bson-5.3.0.tgz", - "integrity": "sha512-ukmCZMneMlaC5ebPHXIkP8YJzNl5DC41N5MAIvKDqLggdao342t4McltoJBQfQya/nHBWAcSsYRqlXPoQkTJag==" + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/bson/-/bson-5.4.0.tgz", + "integrity": "sha512-WRZ5SQI5GfUuKnPTNmAYPiKIof3ORXAF4IRU5UcgmivNIon01rWQlw5RUH954dpu8yGL8T59YShVddIPaU/gFA==" }, "buffer": { "version": "4.9.2", @@ -49176,11 +49184,11 @@ "dev": true }, "mongodb": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-5.6.0.tgz", - "integrity": "sha512-z8qVs9NfobHJm6uzK56XBZF8XwM9H294iRnB7wNjF0SnY93si5HPziIJn+qqvUR5QOff/4L0gCD6SShdR/GtVQ==", + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-5.7.0.tgz", + "integrity": "sha512-zm82Bq33QbqtxDf58fLWBwTjARK3NSvKYjyz997KSy6hpat0prjeX/kxjbPVyZY60XYPDNETaHkHJI2UCzSLuw==", "requires": { - "bson": "^5.3.0", + "bson": "^5.4.0", "mongodb-connection-string-url": "^2.6.0", "saslprep": "^1.0.3", "socks": "^2.7.1" diff --git a/package.json b/package.json index f74390d8c7..3e46379de8 100644 --- a/package.json +++ b/package.json @@ -115,7 +115,7 @@ "husky": "^8.0.3", "lerna": "^4.0.0", "mocha": "^10.2.0", - "mongodb": "^5.6.0", + "mongodb": "^5.7.0", "node-gyp": "^9.0.0", "nyc": "^15.1.0", "pkg-up": "^3.1.0", diff --git a/packages/arg-parser/package.json b/packages/arg-parser/package.json index ab6f047580..f7ef1703af 100644 --- a/packages/arg-parser/package.json +++ b/packages/arg-parser/package.json @@ -44,7 +44,7 @@ "@mongodb-js/tsconfig-mongosh": "^1.0.0", "depcheck": "^1.4.3", "eslint": "^7.25.0", - "mongodb": "^5.6.0", + "mongodb": "^5.7.0", "prettier": "^2.8.8" } } diff --git a/packages/cli-repl/package.json b/packages/cli-repl/package.json index 033f52d534..b285aafdd6 100644 --- a/packages/cli-repl/package.json +++ b/packages/cli-repl/package.json @@ -107,7 +107,7 @@ "eslint": "^7.25.0", "lodash": "^4.17.21", "moment": "^2.29.1", - "mongodb": "^5.6.0", + "mongodb": "^5.7.0", "mongodb-crypt-library-dummy": "^1.0.2", "node-fetch": "^2.6.1", "prettier": "^2.8.8", diff --git a/packages/service-provider-core/package.json b/packages/service-provider-core/package.json index 9412edf9f5..c79a626b39 100644 --- a/packages/service-provider-core/package.json +++ b/packages/service-provider-core/package.json @@ -44,7 +44,7 @@ "@aws-sdk/credential-providers": "^3.347.1", "@mongosh/errors": "0.0.0-dev.0", "bson": "^5.3.0", - "mongodb": "^5.6.0", + "mongodb": "^5.7.0", "mongodb-build-info": "^1.6.2" }, "optionalDependencies": { diff --git a/packages/service-provider-server/package.json b/packages/service-provider-server/package.json index 9d05e081f4..4e230e268b 100644 --- a/packages/service-provider-server/package.json +++ b/packages/service-provider-server/package.json @@ -51,7 +51,7 @@ "@mongosh/types": "0.0.0-dev.0", "@types/sinon-chai": "^3.2.4", "aws4": "^1.11.0", - "mongodb": "^5.6.0", + "mongodb": "^5.7.0", "mongodb-connection-string-url": "^2.6.0", "saslprep": "mongodb-js/saslprep#v1.0.4" }, diff --git a/packages/service-provider-server/src/cli-service-provider.spec.ts b/packages/service-provider-server/src/cli-service-provider.spec.ts index 2bd1baed4e..2631400a0f 100644 --- a/packages/service-provider-server/src/cli-service-provider.spec.ts +++ b/packages/service-provider-server/src/cli-service-provider.spec.ts @@ -1105,7 +1105,6 @@ describe('CliServiceProvider', function () { getSearchIndexesOptions = { allowDiskUse: true }; collectionStub = stubInterface(); - // @ts-expect-error still @internal collectionStub.listSearchIndexes.returns(nativeMethodResult); serviceProvider = new CliServiceProvider( createClientStub(collectionStub), @@ -1123,7 +1122,6 @@ describe('CliServiceProvider', function () { getSearchIndexesOptions ); expect(result).to.deep.equal(descriptions); - // @ts-expect-error still @internal expect(collectionStub.listSearchIndexes).to.have.been.calledWith( null, getSearchIndexesOptions @@ -1140,7 +1138,6 @@ describe('CliServiceProvider', function () { getSearchIndexesOptions ); expect(result).to.deep.equal(descriptions); - // @ts-expect-error still @internal expect(collectionStub.listSearchIndexes).to.have.been.calledWith( 'my-index', getSearchIndexesOptions @@ -1162,7 +1159,6 @@ describe('CliServiceProvider', function () { nativeMethodResult = ['index_1']; collectionStub = stubInterface(); - // @ts-expect-error still @internal collectionStub.createSearchIndexes.resolves(nativeMethodResult); serviceProvider = new CliServiceProvider( createClientStub(collectionStub), @@ -1178,7 +1174,6 @@ describe('CliServiceProvider', function () { descriptions ); expect(result).to.deep.equal(nativeMethodResult); - // @ts-expect-error still @internal expect(collectionStub.createSearchIndexes).to.have.been.calledWith( descriptions ); @@ -1192,7 +1187,6 @@ describe('CliServiceProvider', function () { indexName = 'foo'; collectionStub = stubInterface(); - // @ts-expect-error still @internal collectionStub.dropSearchIndex.resolves(); serviceProvider = new CliServiceProvider( createClientStub(collectionStub), @@ -1208,7 +1202,6 @@ describe('CliServiceProvider', function () { indexName ); expect(result).to.deep.equal(undefined); - // @ts-expect-error still @internal expect(collectionStub.dropSearchIndex).to.have.been.calledWith(indexName); }); }); @@ -1223,7 +1216,6 @@ describe('CliServiceProvider', function () { collectionStub = stubInterface(); - // @ts-expect-error still @internal collectionStub.updateSearchIndex.resolves(); serviceProvider = new CliServiceProvider( createClientStub(collectionStub), @@ -1240,7 +1232,6 @@ describe('CliServiceProvider', function () { description ); expect(result).to.deep.equal(undefined); - // @ts-expect-error still @internal expect(collectionStub.updateSearchIndex).to.have.been.calledWith( indexName, description diff --git a/packages/service-provider-server/src/cli-service-provider.ts b/packages/service-provider-server/src/cli-service-provider.ts index 4072f95bb0..2678e6ba7a 100644 --- a/packages/service-provider-server/src/cli-service-provider.ts +++ b/packages/service-provider-server/src/cli-service-provider.ts @@ -1356,13 +1356,12 @@ class CliServiceProvider options?: Document, dbOptions?: DbOptions ): Promise { - return ( - this.db(database, dbOptions) - .collection(collection) - // @ts-expect-error still @internal - .listSearchIndexes(indexName, options) - .toArray() - ); + const col = this.db(database, dbOptions).collection(collection); + if (indexName === undefined) { + return col.listSearchIndexes(options).toArray(); + } else { + return col.listSearchIndexes(indexName, options).toArray(); + } } createSearchIndexes( @@ -1372,12 +1371,9 @@ class CliServiceProvider specs: { name: string; definition: Document }[], dbOptions?: DbOptions ): Promise { - return ( - this.db(database, dbOptions) - .collection(collection) - // @ts-expect-error still @internal - .createSearchIndexes(specs) - ); + return this.db(database, dbOptions) + .collection(collection) + .createSearchIndexes(specs); } dropSearchIndex( @@ -1386,12 +1382,9 @@ class CliServiceProvider indexName: string, dbOptions?: DbOptions ): Promise { - return ( - this.db(database, dbOptions) - .collection(collection) - // @ts-expect-error still @internal - .dropSearchIndex(indexName) - ); + return this.db(database, dbOptions) + .collection(collection) + .dropSearchIndex(indexName); } updateSearchIndex( @@ -1402,12 +1395,9 @@ class CliServiceProvider definition: Document, dbOptions?: DbOptions ): Promise { - return ( - this.db(database, dbOptions) - .collection(collection) - // @ts-expect-error still @internal - .updateSearchIndex(indexName, definition) - ); + return this.db(database, dbOptions) + .collection(collection) + .updateSearchIndex(indexName, definition); } } diff --git a/packages/shell-api/package.json b/packages/shell-api/package.json index 30fb06f4bc..118d5155a4 100644 --- a/packages/shell-api/package.json +++ b/packages/shell-api/package.json @@ -53,7 +53,7 @@ "bson": "^5.3.0", "depcheck": "^1.4.3", "eslint": "^7.25.0", - "mongodb": "^5.6.0", + "mongodb": "^5.7.0", "prettier": "^2.8.8", "semver": "^7.5.3" } diff --git a/packages/shell-api/src/integration.spec.ts b/packages/shell-api/src/integration.spec.ts index fe994436e5..c997af7438 100644 --- a/packages/shell-api/src/integration.spec.ts +++ b/packages/shell-api/src/integration.spec.ts @@ -2478,6 +2478,7 @@ describe('Shell API (integration)', function () { expect(mongo.getWriteConcern()).to.deep.equal({ w: 'majority', wtimeout: 200, + wtimeoutMS: 200, }); expect(serviceProvider.mongoClient).to.not.equal(oldMC); }); diff --git a/packages/shell-api/src/mongo.ts b/packages/shell-api/src/mongo.ts index b6195e43fa..de3a8a7070 100644 --- a/packages/shell-api/src/mongo.ts +++ b/packages/shell-api/src/mongo.ts @@ -62,6 +62,11 @@ import { ShellApiErrors } from './error-codes'; import type { LogEntry } from './log-entry'; import { parseAnyLogEntry } from './log-entry'; +/* Utility, inverse of Readonly */ +type Mutable = { + -readonly [P in keyof T]: T[P]; +}; + @shellApiClassDefault @classPlatforms(['CLI']) export default class Mongo extends ShellApiClass { @@ -591,7 +596,7 @@ export default class Mongo extends ShellApiClass { jValue?: boolean | undefined ): Promise { const options: MongoClientOptions = {}; - let concern: WriteConcern; + let concern: Mutable; if (typeof concernOrWValue === 'object') { if (wtimeoutMSValue !== undefined || jValue !== undefined) { @@ -617,6 +622,7 @@ export default class Mongo extends ShellApiClass { CommonErrors.InvalidArgument ); } + concern.w = concernOrWValue as any; if (wtimeoutMSValue !== undefined) { diff --git a/packages/types/package.json b/packages/types/package.json index 68e610bdf4..38630948cc 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -44,7 +44,7 @@ "@mongodb-js/tsconfig-mongosh": "^1.0.0", "depcheck": "^1.4.3", "eslint": "^7.25.0", - "mongodb": "^5.6.0", + "mongodb": "^5.7.0", "prettier": "^2.8.8" } }