Skip to content

Commit 53a0aae

Browse files
authored
feat(NODE-4795): deprecate addUser helper (#3624)
1 parent 8d76a71 commit 53a0aae

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/admin.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ export class Admin {
106106
* @param username - The username for the new user
107107
* @param passwordOrOptions - An optional password for the new user, or the options for the command
108108
* @param options - Optional settings for the command
109+
* @deprecated Use the createUser command in `db.command()` instead.
110+
* @see https://www.mongodb.com/docs/manual/reference/command/createUser/
109111
*/
110112
async addUser(
111113
username: string,

src/db.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,8 @@ export class Db {
405405
* @param username - The username for the new user
406406
* @param passwordOrOptions - An optional password for the new user, or the options for the command
407407
* @param options - Optional settings for the command
408+
* @deprecated Use the createUser command in `db.command()` instead.
409+
* @see https://www.mongodb.com/docs/manual/reference/command/createUser/
408410
*/
409411
async addUser(
410412
username: string,

src/operations/add_user.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import { Callback, emitWarningOnce, getTopology } from '../utils';
99
import { CommandOperation, CommandOperationOptions } from './command';
1010
import { Aspect, defineAspects } from './operation';
1111

12-
/** @public */
12+
/**
13+
* @public
14+
* @deprecated Use the createUser command directly instead.
15+
*/
1316
export interface RoleSpecification {
1417
/**
1518
* A role grants privileges to perform sets of actions on defined resources.
@@ -20,7 +23,10 @@ export interface RoleSpecification {
2023
db: string;
2124
}
2225

23-
/** @public */
26+
/**
27+
* @public
28+
* @deprecated Use the createUser command directly instead.
29+
*/
2430
export interface AddUserOptions extends CommandOperationOptions {
2531
/** Roles associated with the created user */
2632
roles?: string | string[] | RoleSpecification | RoleSpecification[];

0 commit comments

Comments
 (0)