So i am trying to use Node.js and Mongodb together and the goal is to use Node to get information and store it in a database with Mongodb. SO I have both Node and Mongdb intalled, and I install the Mongodb package with npm, this is the package mongodb recommends. But the problem I am having is that when I try to do
MongoClient.connect("mongodb://localhost:3000/exampleDb", function(err, db) {
if(err) { return console.dir(err); }else{
var collection =db.createCollection('test', function(err, collection) {}); }});
and I go to localhost:port_for express_server, but when the above code is supposed to run I get [Error: failed to connect to [localhost:3000]] in the Node console.Am I supposed to be running mongodb in the background or how is this supposed to work?