Welcome aboard! We are happy you are here and wish you good net-raft!
// at first you install "npm install mongodb"
//put this code into app.js
var http = require('http');
var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://localhost:27017/MyDb";
MongoClient.connect(url, function(err, db) {
if (err) throw err;
db.collection("your_table_name").find({}).toArray(function(err, result) {
if (err) throw err;
console.log(result);
db.close();
});
});
// type "node app.js" in command prompt
The most helpful NODEJS solutions
get user ipNODEJS Click to see more ... 7.6K 1.7K