================= Database Commands ================= Database commands allow you to perform a wide range of diagnostic and administrative tasks with the Node.js driver. For example, the :manual:`dbStats ` command returns storage statistics for a given database. Use the ``command`` function to access database commands. .. code-block:: js const { MongoClient } = require('mongodb'); // Connection URL const url = 'mongodb://localhost:27017'; // Create a new MongoClient const client = new MongoClient(url); async function main(client) { const db = client.db('myproject'); const results = await db.command({ dbStats: 1 }); console.log(results); } // Function to connect to the server and run your code async function run() { try { // Connect the client to the server await client.connect(); console.log('Connected successfully to server'); await main(client); } finally { // Ensures that the client will close when you finish/error await client.close(); } } // Runs your code run(); For a complete list of database commands, see the :manual:`manual ` .