When i try to close the connection between NodeJS and MongoDB cluster i get mongoClient.close is not a function. Please help
Node JS MongoDB code
const mongoClient = require("mongodb").MongoClient;
exports.getInfo = async (czytnik_id) => {
return new Promise((resolve, reject) => {
mongoClient.connect(process.env.URI, { useUnifiedTopology: true }, (err, db) => {
if (err) reject(err);
const dbo = db.db('TTI');
const res = dbo.collection('3P').findOne({ id: czytnik_id });
mongoClient.close()
resolve(res);
});
});
}