let Categories
mongoClient.connect((error, client) => {
if(error) throw error
let db = client.db('Project')
let categories = db.collection('categories')
categories.find().toArray((error, results) => {
Categories = results
console.log(Categories) // Все ок, выводит
client.close()
})
})
console.log(Categories) // undefined