Connection Problem
Having problem connecting to MongoDB 3.04 with Mongojs 1.2.1. I'm not starting MongoDB in auth mode.
Source code found in server.js:
var http = require('http'); var express = require('express'); var app = express(); var mongojs = require('mongojs');
var db = mongojs('homemanager', ['contactlist']);
db.on('error', function (err) { console.log('database error', err) })
app.use(express.static(__dirname + '/public'));
app.get('/contactlist', function (req, res) { console.log("I recieved a get request");
db.contactlist.find(function (err, docs) {
create.log(docs);
res.json(docs);
});
});
app.listen(3000); console.log('Server running on Port 3000');
Error Message back to Nodejs console:
C:\Users\Gary\Documents\Visual Studio 2015\Projects\NodeTestApp\NodeTestApp\serv
er.js:8
db.on('error', function (err) {
^
TypeError: undefined is not a function
at Object.
Any help greatly appreciated. Gary
I'm experiencing the same problem with both db.on('ready', function()) and db.on('error', function()).
Fixed in version 1.3.0