Written the code which will fetch the data from the Mongo db and print in the console .But it is not displaying me any thing and getting stoped
Console O/P -
(node:85991) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
Code
const MongoClient = require ('mongodb');
const url = 'mongodb://10.142.206.22:27017/';
const databasename = 'snapp_transactions'; // Database name
MongoClient.connect (url).then ((client) => {
const connect = client.db (databasename);
// Connect to collection
const collection = connect
.collection ('redemptions');
collection.find ({}).toArray ().then ((ans) => {
console.log (ans);
});
}).catch ((err) => {
// Printing the error message
console.log (err.Message);
});