I am very new to MongoDB and node. So first of all:
- How can I install MongoDB using the terminal on a Mac computer
- Then how can I connect MongoDB with node?
How can I create a database in MongoDB using node?
Any help is appreciated. Thank You.
var MongoClient = require('mongodb').MongoClient; var url = "mongodb://localhost:8080/mydb"; MongoClient.connect(url, function(err, db){ if(err) { console.log('error'); throw err; } else { console.log('success'); } });
I tried this code but it shows an error.
This is the error I received:
