0

Background:

  • Using vagrant virtual box running Ubuntu on a macbook
  • Having installed the mongoid gem in a new rails application
  • I am given localhost:27017 as the port that the mongodb server is running on.

From the command line, I am able to start/stop the mongodb server and interact with the default database through the mongo console.

Problem: I am not able to connect to localhost:27017 from the browser as suggested by various tutorials to confirm that mongodb is running correctly.

Question: What are some commands, debugging protocols, or log files that I can use to locate the cause of my problem? (i.e. why I can use the mongodb service via command line but can not connect in browser).

And: Based on the background information, if there is a common installation and set-up step that I might have missed, what could that be?

BrianWilson
  • 101
  • 1

1 Answers1

0

It is not possible to connect to the main mongodb port using a browser; your tutorials may be wrong.

The mongodb service does not use http, or any of the other protocols which your browser is familiar with; instead it uses a specific MongoDB protocol, and your browser will not be able to communicate over it.

There is a feature of MongoDB which can expose a REST API over http; perhaps this is what your tutorials are asking you to use, but:

  1. This interface is deprecated, and disabled by default. The advice has for a long time been to make sure this is disabled for security reasons.
  2. If enabled, it listens on a different port e.g. 28017