https://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | \
sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
sudo apt-get update
sudo apt-get install -y mongodb-org
service mongod status
mongo --hostname <hostname> \
--port <port> \
-u <username> \
-p <password> \
--athenticationDatabase <database>
exit
quit()
<ctrl + l>
version()
hostInfo()
stats()
serverStatus()
getLastError()
shutdownServer()
https://docs.mongodb.org/manual/reference/configuration-options/
sudo nano /etc/mongod.conf
# print the last 24 lines of the debug log
sudo tail -24 /var/log/mongodb/mongod.log
show dbs
show databases
use <database_name>
db
use <new_database_name>
db.dropDatabase();
db.copyDatabase('old_name', 'new_name'); # Copy the database to a new database
use <old_name> # Switch to the database you wish to delete
db.dropDatabase(); # Destroys the selected database
show users
db.AddUser({user: "<username>", pwd: "<password>", roles: ["readWrite"]});
show collections
db.getCollectionNames()
mongoimport --db <database> \
-c <collection> \
--file <filename> \
--type <type>
mongodump --db <database> \
-c <collection>
mongorestore --db <database> \
-c <collection> \
<bson_file>