Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/cmap/auth/mongo_credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import { GSSAPICanonicalizationValue } from './gssapi';
import type { OIDCCallbackFunction } from './mongodb_oidc';
import { AUTH_MECHS_AUTH_SRC_EXTERNAL, AuthMechanism } from './providers';

// https://github.com/mongodb/specifications/blob/master/source/auth/auth.rst
/**
* @see https://github.com/mongodb/specifications/blob/master/source/auth/auth.md
*/
function getDefaultAuthMechanism(hello: Document | null): AuthMechanism {
if (hello) {
// If hello contains saslSupportedMechs, use scram-sha-256
Expand Down
2 changes: 1 addition & 1 deletion src/cmap/auth/mongodb_aws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export class MongoDBAWS extends AuthProvider {

if (!ByteUtils.equals(serverNonce.subarray(0, nonce.byteLength), nonce)) {
// throw because the serverNonce's leading 32 bytes must equal the client nonce's 32 bytes
// https://github.com/mongodb/specifications/blob/875446db44aade414011731840831f38a6c668df/source/auth/auth.rst#id11
// https://github.com/mongodb/specifications/blob/master/source/auth/auth.md#conversation-5

// TODO(NODE-3483)
throw new MongoRuntimeError('Server nonce does not begin with client nonce');
Expand Down
2 changes: 1 addition & 1 deletion src/cmap/handshake/client_metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const NODE_DRIVER_VERSION = require('../../../package.json').version;

/**
* @public
* @see https://github.com/mongodb/specifications/blob/master/source/mongodb-handshake/handshake.rst#hello-command
* @see https://github.com/mongodb/specifications/blob/master/source/mongodb-handshake/handshake.md#hello-command
*/
export interface ClientMetadata {
driver: {
Expand Down
14 changes: 7 additions & 7 deletions src/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ const kErrorLabels = Symbol('errorLabels');
/**
* @internal
* The legacy error message from the server that indicates the node is not a writable primary
* https://github.com/mongodb/specifications/blob/b07c26dc40d04ac20349f989db531c9845fdd755/source/server-discovery-and-monitoring/server-discovery-and-monitoring.rst#not-writable-primary-and-node-is-recovering
* https://github.com/mongodb/specifications/blob/921232976f9913cf17415b5ef937ee772e45e6ae/source/server-discovery-and-monitoring/server-discovery-and-monitoring.md#not-writable-primary-and-node-is-recovering
*/
export const LEGACY_NOT_WRITABLE_PRIMARY_ERROR_MESSAGE = new RegExp('not master', 'i');

/**
* @internal
* The legacy error message from the server that indicates the node is not a primary or secondary
* https://github.com/mongodb/specifications/blob/b07c26dc40d04ac20349f989db531c9845fdd755/source/server-discovery-and-monitoring/server-discovery-and-monitoring.rst#not-writable-primary-and-node-is-recovering
* https://github.com/mongodb/specifications/blob/921232976f9913cf17415b5ef937ee772e45e6ae/source/server-discovery-and-monitoring/server-discovery-and-monitoring.md#not-writable-primary-and-node-is-recovering
*/
export const LEGACY_NOT_PRIMARY_OR_SECONDARY_ERROR_MESSAGE = new RegExp(
'not master or secondary',
Expand All @@ -33,7 +33,7 @@ export const LEGACY_NOT_PRIMARY_OR_SECONDARY_ERROR_MESSAGE = new RegExp(
/**
* @internal
* The error message from the server that indicates the node is recovering
* https://github.com/mongodb/specifications/blob/b07c26dc40d04ac20349f989db531c9845fdd755/source/server-discovery-and-monitoring/server-discovery-and-monitoring.rst#not-writable-primary-and-node-is-recovering
* https://github.com/mongodb/specifications/blob/921232976f9913cf17415b5ef937ee772e45e6ae/source/server-discovery-and-monitoring/server-discovery-and-monitoring.md#not-writable-primary-and-node-is-recovering
*/
export const NODE_IS_RECOVERING_ERROR_MESSAGE = new RegExp('node is recovering', 'i');

Expand Down Expand Up @@ -69,7 +69,7 @@ export const MONGODB_ERROR_CODES = Object.freeze({
ReadConcernMajorityNotAvailableYet: 134
} as const);

// From spec@https://github.com/mongodb/specifications/blob/f93d78191f3db2898a59013a7ed5650352ef6da8/source/change-streams/change-streams.rst#resumable-error
// From spec https://github.com/mongodb/specifications/blob/921232976f9913cf17415b5ef937ee772e45e6ae/source/change-streams/change-streams.md#resumable-error
export const GET_MORE_RESUMABLE_CODES = new Set<number>([
MONGODB_ERROR_CODES.HostUnreachable,
MONGODB_ERROR_CODES.HostNotFound,
Expand Down Expand Up @@ -1303,7 +1303,7 @@ export class MongoWriteConcernError extends MongoServerError {
}
}

// https://github.com/mongodb/specifications/blob/master/source/retryable-reads/retryable-reads.rst#retryable-error
// https://github.com/mongodb/specifications/blob/master/source/retryable-reads/retryable-reads.md#retryable-error
const RETRYABLE_READ_ERROR_CODES = new Set<number>([
MONGODB_ERROR_CODES.HostUnreachable,
MONGODB_ERROR_CODES.HostNotFound,
Expand All @@ -1320,7 +1320,7 @@ const RETRYABLE_READ_ERROR_CODES = new Set<number>([
MONGODB_ERROR_CODES.ReadConcernMajorityNotAvailableYet
]);

// see: https://github.com/mongodb/specifications/blob/master/source/retryable-writes/retryable-writes.rst#terms
// see: https://github.com/mongodb/specifications/blob/master/source/retryable-writes/retryable-writes.md#terms
const RETRYABLE_WRITE_ERROR_CODES = RETRYABLE_READ_ERROR_CODES;

export function needsRetryableWriteLabel(
Expand Down Expand Up @@ -1457,7 +1457,7 @@ export function isNodeShuttingDownError(err: MongoError): boolean {
* then the pool will be cleared, and server state will completely reset
* locally.
*
* @see https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring.rst#not-master-and-node-is-recovering
* @see https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring.md#not-writable-primary-and-node-is-recovering
*/
export function isSDAMUnrecoverableError(error: MongoError): boolean {
// NOTE: null check is here for a strictly pre-CMAP world, a timeout or
Expand Down
2 changes: 1 addition & 1 deletion src/mongo_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ export interface MongoClientOptions extends BSONSerializeOptions, SupportedNodeC
*
* @remarks
* Automatic encryption is an enterprise only feature that only applies to operations on a collection. Automatic encryption is not supported for operations on a database or view, and operations that are not bypassed will result in error
* (see [libmongocrypt: Auto Encryption Allow-List](https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/client-side-encryption.rst#libmongocrypt-auto-encryption-allow-list)). To bypass automatic encryption for all operations, set bypassAutoEncryption=true in AutoEncryptionOpts.
* (see [libmongocrypt: Auto Encryption Allow-List](https://github.com/mongodb/specifications/blob/master/source/client-side-encryption/client-side-encryption.md#libmongocrypt-auto-encryption-allow-list)). To bypass automatic encryption for all operations, set bypassAutoEncryption=true in AutoEncryptionOpts.
*
* Automatic encryption requires the authenticated user to have the [listCollections privilege action](https://www.mongodb.com/docs/manual/reference/command/listCollections/#dbcmd.listCollections).
*
Expand Down
2 changes: 1 addition & 1 deletion src/read_concern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class ReadConcern {
* A spec test exists that allows level to be any string.
* "invalid readConcern with out stage"
* @see ./test/spec/crud/v2/aggregate-out-readConcern.json
* @see https://github.com/mongodb/specifications/blob/master/source/read-write-concern/read-write-concern.rst#unknown-levels-and-additional-options-for-string-based-readconcerns
* @see https://github.com/mongodb/specifications/blob/master/source/read-write-concern/read-write-concern.md#unknown-levels-and-additional-options-for-string-based-readconcerns
*/
this.level = ReadConcernLevel[level] ?? level;
}
Expand Down
4 changes: 2 additions & 2 deletions src/sdam/server_description.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ export class ServerDescription {
}

/**
* Determines if another `ServerDescription` is equal to this one per the rules defined
* in the {@link https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring.rst#serverdescription|SDAM spec}
* Determines if another `ServerDescription` is equal to this one per the rules defined in the SDAM specification.
* @see https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring.md
*/
equals(other?: ServerDescription | null): boolean {
// Despite using the comparator that would determine a nullish topologyVersion as greater than
Expand Down
7 changes: 5 additions & 2 deletions src/sdam/server_selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ export function secondaryWritableServerSelector(

/**
* Reduces the passed in array of servers by the rules of the "Max Staleness" specification
* found here: https://github.com/mongodb/specifications/blob/master/source/max-staleness/max-staleness.rst
* found here:
*
* @see https://github.com/mongodb/specifications/blob/master/source/max-staleness/max-staleness.md
*
* @param readPreference - The read preference providing max staleness guidance
* @param topologyDescription - The topology description
Expand Down Expand Up @@ -212,7 +214,8 @@ function tagSetReducer(
/**
* Reduces a list of servers to ensure they fall within an acceptable latency window. This is
* further specified in the "Server Selection" specification, found here:
* https://github.com/mongodb/specifications/blob/master/source/server-selection/server-selection.rst
*
* @see https://github.com/mongodb/specifications/blob/master/source/server-selection/server-selection.md
*
* @param topologyDescription - The topology description
* @param servers - The list of servers to reduce
Expand Down
7 changes: 5 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1097,8 +1097,11 @@ export function shuffle<T>(sequence: Iterable<T>, limit = 0): Array<T> {
return limit % items.length === 0 ? items : items.slice(lowerBound);
}

// TODO(NODE-4936): read concern eligibility for commands should be codified in command construction
// @see https://github.com/mongodb/specifications/blob/master/source/read-write-concern/read-write-concern.rst#read-concern
/**
* TODO(NODE-4936): read concern eligibility for commands should be codified in command construction
* @internal
* @see https://github.com/mongodb/specifications/blob/master/source/read-write-concern/read-write-concern.md#read-concern
*/
export function commandSupportsReadConcern(command: Document): boolean {
if (command.aggregate || command.count || command.distinct || command.find || command.geoNear) {
return true;
Expand Down
53 changes: 0 additions & 53 deletions test/spec/auth/README.rst

This file was deleted.

Loading