Pre Exam Test Practice (SSC | Banking | IAS | GATE | State Level | CLAT | Railways | Insurance | Teaching Exams | NDA | Defence | IES |State Exam )

Organizational Research By

Surprising Reserch Topic

cannot access mongodb through browser it looks like you are trying to access m

cannot access mongodb through browser it looks like you are trying to access m  using -'node.js,mongodb,express'

I open terminal and enter the following commands

sudo mongod

which then outputs

[initandlisten] waiting for connections on port 27017

I open another terminal and enter

sudo mongo

which open the mongo shell and prompts for mongo commands, but when I go to localhost/27017 I receive the following message:

It looks like you are trying to access MongoDB over HTTP on the native driver port.

I created a simple nodejs application using express and when I POST data it seems the mongodb gets hung up. This is the message which I receive in the terminal in which I start my express application and the page never posts the data. So I believe the problem lies within mongo but I cannot figure it out.

POST /info 200 120002ms

Here is my express code

var Info = require('../models/info');
var path = require('path');
var fs = require('fs');
var join = path.join;

exports.form = function(req,res){

    res.render('info', {
        myName: 'Michael'

exports.submit = function(){
console.log('Within exports.submit 1');
    return function(req,res,next){
        console.log('Within exports.submit 2 ');
        var firstName =;
        var lastName =;
            firstName: firstName,
            lastName: lastName
            if(err) return next(err);



var mongoose = require('mongoose');

var schema = new mongoose.Schema({
    firstName: String,
    lastName: String

module.exports = mongoose.model('info',schema);




asked Sep 18, 2015 by mcasudhir
0 votes

Related Hot Questions

Government Jobs Opening