Skip to content

Commit

Permalink
feat(NODE-5838): remove support for server 3.6 (#4182)
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed Sep 16, 2024
1 parent 8b0f354 commit 7b71e1f
Show file tree
Hide file tree
Showing 261 changed files with 619 additions and 909 deletions.
2 changes: 1 addition & 1 deletion .evergreen/ci_matrix_constants.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const MONGODB_VERSIONS = ['latest', 'rapid', '8.0', '7.0', '6.0', '5.0', '4.4', '4.2', '4.0', '3.6'];
const MONGODB_VERSIONS = ['latest', 'rapid', '8.0', '7.0', '6.0', '5.0', '4.4', '4.2', '4.0'];
const versions = [
{ codeName: 'gallium', versionNumber: 16, npmVersion: 9 },
{ codeName: 'hydrogen', versionNumber: 18, npmVersion: 'latest' },
Expand Down
129 changes: 0 additions & 129 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1760,57 +1760,6 @@ tasks:
- func: bootstrap mongo-orchestration
- func: bootstrap kms servers
- func: run tests
- name: test-3.6-server
tags:
- '3.6'
- server
commands:
- command: expansions.update
type: setup
params:
updates:
- {key: NPM_VERSION, value: '9'}
- {key: VERSION, value: '3.6'}
- {key: TOPOLOGY, value: server}
- {key: AUTH, value: auth}
- func: install dependencies
- func: bootstrap mongo-orchestration
- func: bootstrap kms servers
- func: run tests
- name: test-3.6-replica_set
tags:
- '3.6'
- replica_set
commands:
- command: expansions.update
type: setup
params:
updates:
- {key: NPM_VERSION, value: '9'}
- {key: VERSION, value: '3.6'}
- {key: TOPOLOGY, value: replica_set}
- {key: AUTH, value: auth}
- func: install dependencies
- func: bootstrap mongo-orchestration
- func: bootstrap kms servers
- func: run tests
- name: test-3.6-sharded_cluster
tags:
- '3.6'
- sharded_cluster
commands:
- command: expansions.update
type: setup
params:
updates:
- {key: NPM_VERSION, value: '9'}
- {key: VERSION, value: '3.6'}
- {key: TOPOLOGY, value: sharded_cluster}
- {key: AUTH, value: auth}
- func: install dependencies
- func: bootstrap mongo-orchestration
- func: bootstrap kms servers
- func: run tests
- name: test-latest-server-v1-api
tags:
- latest
Expand Down Expand Up @@ -4178,60 +4127,6 @@ tasks:
- func: bootstrap mongo-orchestration
- func: bootstrap kms servers
- func: run tests
- name: test-3.6-server-noauth
tags:
- '3.6'
- server
- noauth
commands:
- command: expansions.update
type: setup
params:
updates:
- {key: NPM_VERSION, value: '9'}
- {key: VERSION, value: '3.6'}
- {key: TOPOLOGY, value: server}
- {key: AUTH, value: noauth}
- func: install dependencies
- func: bootstrap mongo-orchestration
- func: bootstrap kms servers
- func: run tests
- name: test-3.6-replica_set-noauth
tags:
- '3.6'
- replica_set
- noauth
commands:
- command: expansions.update
type: setup
params:
updates:
- {key: NPM_VERSION, value: '9'}
- {key: VERSION, value: '3.6'}
- {key: TOPOLOGY, value: replica_set}
- {key: AUTH, value: noauth}
- func: install dependencies
- func: bootstrap mongo-orchestration
- func: bootstrap kms servers
- func: run tests
- name: test-3.6-sharded_cluster-noauth
tags:
- '3.6'
- sharded_cluster
- noauth
commands:
- command: expansions.update
type: setup
params:
updates:
- {key: NPM_VERSION, value: '9'}
- {key: VERSION, value: '3.6'}
- {key: TOPOLOGY, value: sharded_cluster}
- {key: AUTH, value: noauth}
- func: install dependencies
- func: bootstrap mongo-orchestration
- func: bootstrap kms servers
- func: run tests
- name: test-lambda-example
tags:
- latest
Expand Down Expand Up @@ -4676,9 +4571,6 @@ buildvariants:
- test-4.0-server
- test-4.0-replica_set
- test-4.0-sharded_cluster
- test-3.6-server
- test-3.6-replica_set
- test-3.6-sharded_cluster
- test-latest-server-v1-api
- test-x509-authentication
- test-atlas-connectivity
Expand Down Expand Up @@ -4735,9 +4627,6 @@ buildvariants:
- test-4.0-server
- test-4.0-replica_set
- test-4.0-sharded_cluster
- test-3.6-server
- test-3.6-replica_set
- test-3.6-sharded_cluster
- test-latest-server-v1-api
- test-x509-authentication
- test-atlas-connectivity
Expand Down Expand Up @@ -4794,9 +4683,6 @@ buildvariants:
- test-4.0-server
- test-4.0-replica_set
- test-4.0-sharded_cluster
- test-3.6-server
- test-3.6-replica_set
- test-3.6-sharded_cluster
- test-latest-server-v1-api
- test-x509-authentication
- test-atlas-connectivity
Expand Down Expand Up @@ -4852,9 +4738,6 @@ buildvariants:
- test-4.0-server
- test-4.0-replica_set
- test-4.0-sharded_cluster
- test-3.6-server
- test-3.6-replica_set
- test-3.6-sharded_cluster
- test-latest-server-v1-api
- test-x509-authentication
- test-atlas-connectivity
Expand Down Expand Up @@ -4910,9 +4793,6 @@ buildvariants:
- test-4.0-server
- test-4.0-replica_set
- test-4.0-sharded_cluster
- test-3.6-server
- test-3.6-replica_set
- test-3.6-sharded_cluster
- test-latest-server-v1-api
- test-socks5
- test-socks5-tls
Expand Down Expand Up @@ -4957,9 +4837,6 @@ buildvariants:
- test-4.0-server
- test-4.0-replica_set
- test-4.0-sharded_cluster
- test-3.6-server
- test-3.6-replica_set
- test-3.6-sharded_cluster
- test-latest-server-v1-api
- test-socks5
- test-socks5-tls
Expand Down Expand Up @@ -5004,9 +4881,6 @@ buildvariants:
- test-4.0-server
- test-4.0-replica_set
- test-4.0-sharded_cluster
- test-3.6-server
- test-3.6-replica_set
- test-3.6-sharded_cluster
- test-latest-server-v1-api
- test-socks5
- test-socks5-tls
Expand Down Expand Up @@ -5254,9 +5128,6 @@ buildvariants:
- test-4.0-server-noauth
- test-4.0-replica_set-noauth
- test-4.0-sharded_cluster-noauth
- test-3.6-server-noauth
- test-3.6-replica_set-noauth
- test-3.6-sharded_cluster-noauth
- name: rhel8-test-lambda
display_name: AWS Lambda handler tests
run_on: rhel80-large
Expand Down
10 changes: 2 additions & 8 deletions src/cmap/auth/mongo_credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,10 @@ function getDefaultAuthMechanism(hello: Document | null): AuthMechanism {
? AuthMechanism.MONGODB_SCRAM_SHA256
: AuthMechanism.MONGODB_SCRAM_SHA1;
}

// Fallback to legacy selection method. If wire version >= 3, use scram-sha-1
if (hello.maxWireVersion >= 3) {
return AuthMechanism.MONGODB_SCRAM_SHA1;
}
}

// Default for wireprotocol < 3
return AuthMechanism.MONGODB_CR;
// Default auth mechanism for 4.0 and higher.
return AuthMechanism.MONGODB_SCRAM_SHA256;
}

const ALLOWED_ENVIRONMENT_NAMES: AuthMechanismProperties['ENVIRONMENT'][] = [
Expand Down Expand Up @@ -173,7 +168,6 @@ export class MongoCredentials {
validate(): void {
if (
(this.mechanism === AuthMechanism.MONGODB_GSSAPI ||
this.mechanism === AuthMechanism.MONGODB_CR ||
this.mechanism === AuthMechanism.MONGODB_PLAIN ||
this.mechanism === AuthMechanism.MONGODB_SCRAM_SHA1 ||
this.mechanism === AuthMechanism.MONGODB_SCRAM_SHA256) &&
Expand Down
38 changes: 0 additions & 38 deletions src/cmap/auth/mongocr.ts

This file was deleted.

4 changes: 2 additions & 2 deletions src/cmap/wire_protocol/constants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const MIN_SUPPORTED_SERVER_VERSION = '3.6';
export const MIN_SUPPORTED_SERVER_VERSION = '4.0';
export const MAX_SUPPORTED_SERVER_VERSION = '8.0';
export const MIN_SUPPORTED_WIRE_VERSION = 6;
export const MIN_SUPPORTED_WIRE_VERSION = 7;
export const MAX_SUPPORTED_WIRE_VERSION = 25;
export const MIN_SUPPORTED_QE_WIRE_VERSION = 21;
export const MIN_SUPPORTED_QE_SERVER_VERSION = '7.0';
Expand Down
2 changes: 1 addition & 1 deletion src/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ export class Db {
}

/**
* Execute an aggregation framework pipeline against the database, needs MongoDB \>= 3.6
* Execute an aggregation framework pipeline against the database.
*
* @param pipeline - An array of aggregation stages to be executed
* @param options - Optional settings for the command
Expand Down
3 changes: 1 addition & 2 deletions src/explain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ export type ExplainVerbosity = string;

/**
* For backwards compatibility, true is interpreted as "allPlansExecution"
* and false as "queryPlanner". Prior to server version 3.6, aggregate()
* ignores the verbosity parameter and executes in "queryPlanner".
* and false as "queryPlanner".
* @public
*/
export type ExplainVerbosityLike = ExplainVerbosity | boolean;
Expand Down
10 changes: 8 additions & 2 deletions src/mongo_client_auth_providers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { type AuthProvider } from './cmap/auth/auth_provider';
import { GSSAPI } from './cmap/auth/gssapi';
import { type AuthMechanismProperties } from './cmap/auth/mongo_credentials';
import { MongoCR } from './cmap/auth/mongocr';
import { MongoDBAWS } from './cmap/auth/mongodb_aws';
import { MongoDBOIDC, OIDC_WORKFLOWS, type Workflow } from './cmap/auth/mongodb_oidc';
import { AutomatedCallbackWorkflow } from './cmap/auth/mongodb_oidc/automated_callback_workflow';
Expand All @@ -16,7 +15,14 @@ import { MongoInvalidArgumentError } from './error';
/** @internal */
const AUTH_PROVIDERS = new Map<AuthMechanism | string, (workflow?: Workflow) => AuthProvider>([
[AuthMechanism.MONGODB_AWS, () => new MongoDBAWS()],
[AuthMechanism.MONGODB_CR, () => new MongoCR()],
[
AuthMechanism.MONGODB_CR,
() => {
throw new MongoInvalidArgumentError(
'MONGODB-CR is no longer a supported auth mechanism in MongoDB 4.0+'
);
}
],
[AuthMechanism.MONGODB_GSSAPI, () => new GSSAPI()],
[AuthMechanism.MONGODB_OIDC, (workflow?: Workflow) => new MongoDBOIDC(workflow)],
[AuthMechanism.MONGODB_PLAIN, () => new Plain()],
Expand Down
1 change: 0 additions & 1 deletion test/mongodb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ export * from '../src/cmap/auth/auth_provider';
export * from '../src/cmap/auth/aws_temporary_credentials';
export * from '../src/cmap/auth/gssapi';
export * from '../src/cmap/auth/mongo_credentials';
export * from '../src/cmap/auth/mongocr';
export * from '../src/cmap/auth/mongodb_aws';
export * from '../src/cmap/auth/mongodb_oidc';
export * from '../src/cmap/auth/mongodb_oidc/azure_machine_workflow';
Expand Down
45 changes: 2 additions & 43 deletions test/spec/auth/legacy/connection-string.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,47 +163,6 @@
"uri": "mongodb://localhost/?authMechanism=GSSAPI",
"valid": false
},
{
"description": "should recognize the mechanism (MONGODB-CR)",
"uri": "mongodb://user:password@localhost/?authMechanism=MONGODB-CR",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "admin",
"mechanism": "MONGODB-CR",
"mechanism_properties": null
}
},
{
"description": "should use the database when no authSource is specified (MONGODB-CR)",
"uri": "mongodb://user:password@localhost/foo?authMechanism=MONGODB-CR",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "foo",
"mechanism": "MONGODB-CR",
"mechanism_properties": null
}
},
{
"description": "should use the authSource when specified (MONGODB-CR)",
"uri": "mongodb://user:password@localhost/foo?authMechanism=MONGODB-CR&authSource=bar",
"valid": true,
"credential": {
"username": "user",
"password": "password",
"source": "bar",
"mechanism": "MONGODB-CR",
"mechanism_properties": null
}
},
{
"description": "should throw an exception if no username is supplied (MONGODB-CR)",
"uri": "mongodb://localhost/?authMechanism=MONGODB-CR",
"valid": false
},
{
"description": "should recognize the mechanism (MONGODB-X509)",
"uri": "mongodb://CN%3DmyName%2COU%3DmyOrgUnit%2CO%3DmyOrg%2CL%3DmyLocality%2CST%3DmyState%2CC%3DmyCountry@localhost/?authMechanism=MONGODB-X509",
Expand Down Expand Up @@ -517,7 +476,7 @@
},
{
"description": "should throw an exception if username is specified for test (MONGODB-OIDC)",
"uri": "mongodb://principalName@localhost/?authMechanism=MONGODB-OIDC&ENVIRONMENT:test",
"uri": "mongodb://principalName@localhost/?authMechanism=MONGODB-OIDC&authMechanismProperties=ENVIRONMENT:test",
"valid": false,
"credential": null
},
Expand Down Expand Up @@ -669,4 +628,4 @@
"credential": null
}
]
}
}
Loading

0 comments on commit 7b71e1f

Please sign in to comment.