Retrieve the server build information
Optionaloptions: CommandOperationOptionsOptional settings for the command
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:
apiVersionapiStrictapiDeprecationErrorsWhen 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
Optionaloptions: RunCommandOptionsOptional settings for the command
List the available databases
Optionaloptions: ListDatabasesOptionsOptional settings for the command
Ping the MongoDB server and retrieve results
Optionaloptions: CommandOperationOptionsOptional settings for the command
Remove a user from a database
The username to remove
Optionaloptions: CommandOperationOptionsOptional settings for the command
Get ReplicaSet status
Optionaloptions: CommandOperationOptionsOptional settings for the command
Retrieve the server build information
Optionaloptions: CommandOperationOptionsOptional settings for the command
Retrieve this db's server status.
Optionaloptions: CommandOperationOptionsOptional settings for the command
Validate an existing collection
The name of the collection to validate.
Optional settings for the command
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