From 11c2e69bc11e20aa0dadfa80ab50b49e76333b4b Mon Sep 17 00:00:00 2001 From: Durran Jordan Date: Tue, 4 Apr 2023 13:38:49 +0200 Subject: [PATCH 1/3] feat(NODE-4795): deprecate addUser helper --- src/admin.ts | 1 + src/operations/add_user.ts | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/admin.ts b/src/admin.ts index 9e9a64e0821..1a8ee31bc1e 100644 --- a/src/admin.ts +++ b/src/admin.ts @@ -106,6 +106,7 @@ export class Admin { * @param username - The username for the new user * @param passwordOrOptions - An optional password for the new user, or the options for the command * @param options - Optional settings for the command + * @deprecated Use the createUser command directly instead. */ async addUser( username: string, diff --git a/src/operations/add_user.ts b/src/operations/add_user.ts index be5982a42f6..f2f5e142f27 100644 --- a/src/operations/add_user.ts +++ b/src/operations/add_user.ts @@ -9,7 +9,10 @@ import { Callback, emitWarningOnce, getTopology } from '../utils'; import { CommandOperation, CommandOperationOptions } from './command'; import { Aspect, defineAspects } from './operation'; -/** @public */ +/** + * @public + * @deprecated Use the createUser command directly instead. + */ export interface RoleSpecification { /** * A role grants privileges to perform sets of actions on defined resources. @@ -20,7 +23,10 @@ export interface RoleSpecification { db: string; } -/** @public */ +/** + * @public + * @deprecated Use the createUser command directly instead. + */ export interface AddUserOptions extends CommandOperationOptions { /** Roles associated with the created user */ roles?: string | string[] | RoleSpecification | RoleSpecification[]; From 63edc0f857afbd7749a14169527346aed18ccbe7 Mon Sep 17 00:00:00 2001 From: Durran Jordan Date: Wed, 5 Apr 2023 10:37:25 +0200 Subject: [PATCH 2/3] feat(NODE-4795) deprecate addUser on db --- src/db.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/db.ts b/src/db.ts index b88c54888a7..30b56242f27 100644 --- a/src/db.ts +++ b/src/db.ts @@ -405,6 +405,7 @@ export class Db { * @param username - The username for the new user * @param passwordOrOptions - An optional password for the new user, or the options for the command * @param options - Optional settings for the command + * @deprecated Use the createUser command directly instead. */ async addUser( username: string, From 9f10d2f6714751c2b2ab510da7e2cb826159a7e8 Mon Sep 17 00:00:00 2001 From: Durran Jordan Date: Thu, 6 Apr 2023 11:02:00 +0200 Subject: [PATCH 3/3] chore: update comments --- src/admin.ts | 3 ++- src/db.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/admin.ts b/src/admin.ts index 1a8ee31bc1e..78d7da63e4f 100644 --- a/src/admin.ts +++ b/src/admin.ts @@ -106,7 +106,8 @@ export class Admin { * @param username - The username for the new user * @param passwordOrOptions - An optional password for the new user, or the options for the command * @param options - Optional settings for the command - * @deprecated Use the createUser command directly instead. + * @deprecated Use the createUser command in `db.command()` instead. + * @see https://www.mongodb.com/docs/manual/reference/command/createUser/ */ async addUser( username: string, diff --git a/src/db.ts b/src/db.ts index 30b56242f27..3d60010f3fa 100644 --- a/src/db.ts +++ b/src/db.ts @@ -405,7 +405,8 @@ export class Db { * @param username - The username for the new user * @param passwordOrOptions - An optional password for the new user, or the options for the command * @param options - Optional settings for the command - * @deprecated Use the createUser command directly instead. + * @deprecated Use the createUser command in `db.command()` instead. + * @see https://www.mongodb.com/docs/manual/reference/command/createUser/ */ async addUser( username: string,