How do i access mongodb http?

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 = req.name.first;
        var lastName = req.name.last;
        Info.create({
            firstName: firstName,
            lastName: lastName
        },function(err){
            if(err) return next(err);

            res.redirect('/')
        });
    }
};

Model

var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/info');

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

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

app.js

...
app.get('/info',info.form);
app.post('/info',info.submit);
...

REST Interfaces¶

DrowsyDromedary (Ruby)¶

DrowsyDromedary is a REST layer for MongoDB based on Ruby.

HTTP Interfaces¶

Sleepy Mongoose (Python)¶

Sleepy Mongoose is a full featured HTTP interface for MongoDB.

HTTP Console¶

MongoDB provides a simple http interface listing information of interest to administrators. This interface may be accessed at the port with numeric value 1000 more than the configured mongod port. The default port for the http interface is 28017. To access the http interface an administrator may, for example, point a browser to http://localhost:28017 if mongod is running with the default port on the local machine.

How do i access mongodb http?

Here is a description of the informational elements of the http interface:

elementdescription
db version database version information
git hash database version developer tag
sys info mongod compilation environment
dblocked indicates whether the primary mongod mutex is held
uptime time since this mongod instance was started
assertions any software assertions that have been raised by this mongod instance
replInfo information about replication configuration
currentOp most recent client request
# databases number of databases that have been accessed by this mongod instance
curclient last database accessed by this mongod instance
Cursors describes outstanding client cursors
master whether this mongod instance has been designated a master
slave whether this mongod instance has been designated a slave
initialSyncCompleted whether this slave or repl pair node has completed an initial clone of the mongod instance it is replicating
DBTOP Displays the total time the mongod instance has devoted to each listed collection, as well as the percentage of available time devoted to each listed collection recently and the number of reads, writes, and total calls made recently
dt Timing information about the primary mongod mutex

HTTP Console Security¶

If security is configured for a mongod instance, authentication is required for a client to access the http interface from another machine.

Simple REST Interface¶

The mongod process includes a simple REST interface, with no support for insert/update/remove operations, as a convenience – it is generally used for monitoring/alerting scripts or administrative tasks. For full REST capabilities we recommend using an external tool such as Sleepy.Mongoose.

v1.4+: This interface is disabled by default. Use --rest on the command line to enable.

To get the contents of a collection (note the trailing slash):

http://127.0.0.1:28017/databaseName/collectionName/

To add a limit:

http://127.0.0.1:28017/databaseName/collectionName/?limit=-10

To skip:

http://127.0.0.1:28017/databaseName/collectionName/?skip=5

To query for {a : 1}:

http://127.0.0.1:28017/databaseName/collectionName/?filter_a=1

Separate conditions with an &:

http://127.0.0.1:28017/databaseName/collectionName/?filter_a=1&limit=-10

Same as db.$cmd.findOne({listDatabase:1}) on the admin database in the shell:

http://localhost:28017/admin/$cmd/?filter_listDatabases=1&limit=1

To count documents in a collection:

http://host:port/db/$cmd/?filter_count=collection&limit=1

JSON in the simple REST interface¶

The simple ReST interface uses strict JSON (as opposed to the shell, which uses Dates, regular expressions, etc.). To display non-JSON types, the web interface wraps them in objects and uses the key for the type. For example:

# ObjectIds just become strings
"_id" : "4a8acf6e7fbadc242de5b4f3"

# dates
"date" : { "$date" : 1250609897802 }

# regular expressions
"match" : { "$regex" : "foo", "$options" : "ig" }

The code type has not been implemented yet and causes the DB to crash if you try to display it in the browser.

See Mongo Extended JSON for details.

Replica Set Admin UI¶

The mongod process includes a simple administrative UI for checking the status of a replica set.

To use, first enable --rest from the mongod command line. The rest port is the db port plus 1000 (thus, the default is 28017). Be sure this port is secure before enabling this.

Then you can navigate to http://:28017/ in your web browser. Once there, click Replica Set Status (/_replSet) to move to the Replica Set Status page.

How do i access mongodb http?

  • <   Admin UIs
  • /\  生态系统
  • Munin Configuration Examples  >

How do I access the HTTP interface of MongoDB?

To access the http interface an administrator may, for example, point a browser to http://localhost:28017 if mongod is running with the default port on the local machine.

How do I find my MongoDB URL?

Find MongoDB URI Click on “Overview” tab in the menu bar. Scroll down the Overview page and you will see the MongoDB URI information.

What is the URL of MongoDB connectivity?

connect('mongodb://localhost:27017/myapp'); This is the minimum needed to connect the myapp database running locally on the default port (27017). If connecting fails on your machine, try using 127.0. 0.1 instead of localhost .

Does MongoDB have a web interface?

MongoDB web interface is a tool used to administrate our database server via the web browser, there are multiple web interface tools available in MongoDB. There is multiple features of the web interface in MongoDB like we can create database and collection by using the web interface.