sources : https://www.mongodb.com/
downloaded: https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel62-3.4.6.tgz
extracted: tar xzf mongodb-linux-x86_64-rhel62-3.4.6.tgz
add bin to system path.
#configure different data folder(default is /data/db).
mongod --dbpath /data/mongodb
#start as master node:
mongod --master
#Working in mongo shell:
mongo #gets us into mongo shell.
show dbs; # lists all available databases
use school; #sets(creates if not exists) current working db to school.
show collections; # lists all collections available in selected db.
db.student.insertOne({'name':'Rohit Verma', 'age':'31', 'contact':'123444323'}); #Stores document (converts to BSON[Binary JSON]) into collection named student under current database named school.
db.student.insertOne({'name':'Rahul Verma', 'age':'31', 'contact':'223444323'});
db.dropDatabase(); # Drops current database in use.
db.student.find(); #returns all document in collection student of selected database.
db.student.find({'name':'Rahul Verma', age:'31'}); # returns document that has specified key values.
db.student.remove({'name':'Rohit Verma'}); # removes document