/*
`mongoose.connect` is used to establish a connection to a MongoDB database, while `mongoose.connection` provides access to the active connection and allows you to interact with the database through events and operations.
*/
// see all the methods (https://mongoosejs.com/docs/api/connection.html)
const database = mongoose.connection;
// dbname
database.useDb("users");
// collection name
const collection = database.collection("users");
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter