const MongoClient = require("mongodb").MongoClient;
const url = "mongodb://localhost:27017/";
const mongoClient = new MongoClient(url);
mongoClient.connect(function(err, client){
if(err) return console.log(err);
const db = client.db("world");
const col = db.collection("cyti");
var city = col.find().toArray();
console.log('City: ', city);
});
'use strict';
const { MongoClient } = require('mongodb');
const client = new MongoClient('mongodb://localhost:27017/');
(async function() {
await client.connect();
const result = await client.db('world').collection('cyti').find().toArray();
console.log('City:', result);
})().catch(console.error);