Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Admin

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
import { MongoClient } from 'mongodb';

const client = new MongoClient('mongodb://localhost:27017');
const admin = client.db().admin();
const dbInfo = await admin.listDatabases();
for (const db of dbInfo.databases) {
console.log(db.name);
}

Hierarchy

  • Admin

Index

Methods

  • Remove a user from a database

    Parameters

    • username: string

      The username to remove

    • Optional options: CommandOperationOptions

      Optional settings for the command

    Returns Promise<boolean>

Generated using TypeDoc