const {MongoClient} = require('mongodb');
const uri = "mongodb://localhost:27017";
const database = 'ecommerce'
const client = new MongoClient(uri);
async function getData(){
let result = await client.connect();
let db = result.db(database);
let collection = db.collection('phones');
let response = await collection.find({}).toArray();
console.log(response);
}
getData();