Using the Node Driver
Connect and query from Node.js.
Example
const { MongoClient } = require("mongodb");
const client = new MongoClient("mongodb://localhost:27017");
await client.connect();
const users = client.db("app").collection("users");
console.log(await users.countDocuments());
await client.close();Exercise
Connect.
await client.()
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.