Step 1: Click on Cluster0 (Cluster name)
![enter image description here]()
It will bring you to the Cluster Overview page
Step 2: Click on Collections
![enter image description here]()
It will show a list of databases. you can read name and create/delete databases from here.
Now lets interact with one of the database sample_mflix > collection movies
![enter image description here]()
here is the sample code to Query/Search for a movie that has the title 'Back to the Future' from movies collection:
const { MongoClient } = require("mongodb");
// Replace the uri string with your MongoDB deployment's connection string.
const uri =
"mongodb+srv://<user>:<password>@<cluster-url>?retryWrites=true&writeConcern=majority";
const client = new MongoClient(uri);
async function run() {
try {
await client.connect();
const database = client.db('sample_mflix');
const movies = database.collection('movies');
// Query for a movie that has the title 'Back to the Future'
const query = { title: 'Back to the Future' };
const movie = await movies.findOne(query);
console.log(movie);
} finally {
// Ensures that the client will close when you finish/error
await client.close();
}
}
run().catch(console.dir);
ref: https://www.mongodb.com/docs/drivers/node/current/quick-start/