When you start mongod (the MongoDB daemon), it starts listening on two ports by default.
- 27017: the default port accessed by the various MongoDB drivers.
- 28017: a port that handles HTTP requests and provides some general monitoring.
What you've listed mongodb://fred:foobar@localhost
actually represents this: mongodb://fred:foobar@localhost:27017
and this is the access protocol for MongoDB drivers.
The other "thing" you're seeing is port 28017. This is (by default) simply an overview of what's happening with the mongod
instance on that server. Requests made from a web browser to this port will show an HTML output of the server overview.
If you start mongod
with a different port number (i.e.: 7777), the "monitor" port will always be 1000 higher (i.e.: 8777).
If you want some advanced features like the ability to query via the web browser, you can start mongod
with the --rest
switch. You will then be able to run certain queries with a simple http get requestlink text (http://localhost:8777/mydb/mycollection/?filter_a=1
).
If you're using language-specific MongoDB drivers (like most people will). Then you'll find that you'll have "connection strings" of the form mongodb://user:pwd@host:port/
. These are similar in purpose to the usual connection strings you're used to for other Database products.