Installation
- Copy Download link in timetohide.me and download installation package.
-
Extract package in /opt/ path
- Create /data/db/ directory
- Start Server
sudo ./opt/mongo/bin/mongod
- Execute Shell
sudo ./opt/mongo/bin/mongo
- Show all Data Bases
show dbs
- Use database
use db_name
- Add document to collection
db.collection_name.insert({key: “value” , key2: “value2”})
- Get document values
db.collection_name.find({key: “value”})
- Show collections
show collections
- Get all documents of collection
db.collection_name.find()
Data Storage
With restart server, data are still stored
Reserved TCP Ports
Default Port | Description |
---|---|
27017 | The default port for mongod and mongos instances. You can change this port with port or –port. |
27018 | The default port when running with –shardsvr runtime operation or the shardsvr value for the clusterRolesetting in a configuration file. |
27019 | The default port when running with –configsvr runtime operation or the configsvr value for the clusterRolesetting in a configuration file. |
28017 | The default port for the web status page. The web status page is always accessible at a port number that is 1000greater than the port determined by port. |
Refrences
Monogo DB web site