Difference between revisions of "MongoDB"
Jump to navigation
Jump to search
Rafahsolis (talk | contribs) |
Rafahsolis (talk | contribs) |
||
| Line 27: | Line 27: | ||
== Show databases == | == Show databases == | ||
show dbs | show dbs | ||
| − | * To view databases they must have data | + | * To view databases they must have data<br /> |
| + | To show the current database type: | ||
| + | db | ||
== Insert == | == Insert == | ||
db.movie.insert({"name":"tutorials point"}) | db.movie.insert({"name":"tutorials point"}) | ||
Revision as of 12:03, 25 February 2016
Installation
Ubuntu 14.04
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927 echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list sudo apt-get update sudo apt-get install -y mongodb-org # Specific version install: sudo apt-get install -y mongodb-org=3.2.1 mongodb-org-server=3.2.1 mongodb-org-shell=3.2.1 mongodb-org-mongos=3.2.1 mongodb-org-tools=3.2.1
Start/Stop/Restart MongoDB
sudo service mongod start | stop | restart
Verify that MongoDB has started successfully
Verify that the mongod process has started successfully by checking the contents of the log file at /var/log/mongodb/mongod.log for a line reading
[initandlisten] waiting for connections on port <port>
Guides
Getting Started
Before deploying MongoDB in a production environment
Manage user accounts and roles
Data directories
/var/log/mongodb /var/lib/mongodb
Create Database
use DATABASE_NAME
Show databases
show dbs
- To view databases they must have data
To show the current database type:
db
Insert
db.movie.insert({"name":"tutorials point"})