Add a user to the database
The username for the new user
Optional
passwordOrOptions: string | AddUserOptionsAn optional password for the new user, or the options for the command
Optional
Optional
options: AddUserOptionsOptional settings for the command
Optional
Use the createUser command in db.command()
instead.
https://www.mongodb.com/docs/manual/reference/command/createUser/
Execute a command
The driver will ensure the following fields are attached to the command sent to the server:
lsid
- sourced from an implicit session or options.session$readPreference
- defaults to primary or can be configured by options.readPreference$db
- sourced from the name of this databaseIf the client has a serverApi setting:
apiVersion
apiStrict
apiDeprecationErrors
When in a transaction:
readConcern
- sourced from readConcern set on the TransactionOptionswriteConcern
- sourced from writeConcern set on the TransactionOptionsAttaching any of the above fields to the command will have no effect as the driver will overwrite the value.
The command to execute
Optional
options: RunCommandOptionsOptional settings for the command
Optional
List the available databases
Optional
options: ListDatabasesOptionsOptional settings for the command
Optional
Remove a user from a database
The username to remove
Optional
options: CommandOperationOptionsOptional settings for the command
Optional
Validate an existing collection
The name of the collection to validate.
Optional
options: ValidateCollectionOptionsOptional settings for the command
Optional
Generated using TypeDoc
The Admin class is an internal class that allows convenient access to the admin functionality and commands for MongoDB.
ADMIN Cannot directly be instantiated
Example