I tried to set up a mongodb system with my openlayers map, but it is not working : Uncaught TypeError: Cannot read property 'db' of null. My part of code about mongodb is :
var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://localhost:27017/";
MongoClient.connect(url, function(err, db) {
var tapDB = db.db("tapDB"); //<-- here is the error
})
I suppose that this error is maybe because i am using npm start instear of node server.js, but I am not sure because i am a newbie. Mongodb is started via the cmd by doing the following command :"mongod" and then mongo on an other cmd.
UPDATE: For everyone having the same problem than me, i'd recommand deleting parcel. That's what I did and now it works fine