Why can not I open the MongoDb interface on the port: 28017?

4

I installed mongo on drive C and did some data creation tests and persisted, then I checked and there they were listed perfectly at the prompt. Until then, everything is OK! I open the browser and type localhost: 27017 and the sign of life message appears:

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

But when I try localhost: 28017 I only see:

Esta página da web não está disponível  

What should I do?

    
asked by anonymous 22.01.2016 / 17:13

2 answers

3

Mongodb exposes an http interface, through which we can check its status using port 28017.

To access via browser, the --rest command must be passed to mongod such as:

mongo --dbpath /data/db --rest

Then open your browser:

http://localhost: 28017/mydb/mycollection/

Important : This interface should never be used in a production environment.

More information on this official page Mongodb Http Interfaces

    
23.01.2016 / 17:01
2

Edit the file /etc/mongodb.conf

sudo nano /etc/mongodb.conf

add the line:

rest = true

restart the service

sudo mongod restart

Ready. Now the port is serving REST.

    
29.01.2017 / 01:27